Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
3647c179
Commit
3647c179
authored
Jul 12, 2016
by
Jesse Zoldak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make the temp dir for instructor dashboard local files uniquely named. EV-56
parent
e1dbfe3a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
14 deletions
+26
-14
lms/djangoapps/instructor_task/tests/test_base.py
+26
-10
lms/envs/test.py
+0
-4
No files found.
lms/djangoapps/instructor_task/tests/test_base.py
View file @
3647c179
...
@@ -4,8 +4,9 @@ Base test classes for LMS instructor-initiated background tasks
...
@@ -4,8 +4,9 @@ Base test classes for LMS instructor-initiated background tasks
"""
"""
import
os
import
os
import
json
import
json
from
mock
import
Mock
from
mock
import
Mock
,
patch
import
shutil
import
shutil
from
tempfile
import
mkdtemp
import
unicodecsv
import
unicodecsv
from
uuid
import
uuid4
from
uuid
import
uuid4
...
@@ -290,15 +291,30 @@ class TestReportMixin(object):
...
@@ -290,15 +291,30 @@ class TestReportMixin(object):
"""
"""
Cleans up after tests that place files in the reports directory.
Cleans up after tests that place files in the reports directory.
"""
"""
def
tearDown
(
self
):
def
setUp
(
self
):
report_store
=
ReportStore
.
from_config
(
config_name
=
'GRADES_DOWNLOAD'
)
try
:
def
clean_up_tmpdir
():
reports_download_path
=
report_store
.
storage
.
path
(
''
)
"""Remove temporary directory created for instructor task models."""
except
NotImplementedError
:
if
os
.
path
.
exists
(
self
.
tmp_dir
):
pass
# storage backend does not use the local filesystem
shutil
.
rmtree
(
self
.
tmp_dir
)
else
:
if
os
.
path
.
exists
(
reports_download_path
):
super
(
TestReportMixin
,
self
)
.
setUp
()
shutil
.
rmtree
(
reports_download_path
)
# Ensure that working with the temp directories in tests is thread safe
# by creating a unique temporary directory for each testcase.
self
.
tmp_dir
=
mkdtemp
()
mock_grades_download
=
{
'STORAGE_TYPE'
:
'localfs'
,
'BUCKET'
:
'test-grades'
,
'ROOT_PATH'
:
self
.
tmp_dir
}
self
.
grades_patch
=
patch
.
dict
(
'django.conf.settings.GRADES_DOWNLOAD'
,
mock_grades_download
)
self
.
grades_patch
.
start
()
self
.
addCleanup
(
self
.
grades_patch
.
stop
)
mock_fin_report
=
{
'STORAGE_TYPE'
:
'localfs'
,
'BUCKET'
:
'test-financial-reports'
,
'ROOT_PATH'
:
self
.
tmp_dir
}
self
.
reports_patch
=
patch
.
dict
(
'django.conf.settings.FINANCIAL_REPORTS'
,
mock_fin_report
)
self
.
reports_patch
.
start
()
self
.
addCleanup
(
self
.
reports_patch
.
stop
)
self
.
addCleanup
(
clean_up_tmpdir
)
def
verify_rows_in_csv
(
self
,
expected_rows
,
file_index
=
0
,
verify_order
=
True
,
ignore_other_columns
=
False
):
def
verify_rows_in_csv
(
self
,
expected_rows
,
file_index
=
0
,
verify_order
=
True
,
ignore_other_columns
=
False
):
"""
"""
...
...
lms/envs/test.py
View file @
3647c179
...
@@ -70,10 +70,6 @@ FEATURES['ENABLE_VERIFIED_CERTIFICATES'] = True
...
@@ -70,10 +70,6 @@ FEATURES['ENABLE_VERIFIED_CERTIFICATES'] = True
FEATURES
[
'ENABLE_GRADE_DOWNLOADS'
]
=
True
FEATURES
[
'ENABLE_GRADE_DOWNLOADS'
]
=
True
FEATURES
[
'ALLOW_COURSE_STAFF_GRADE_DOWNLOADS'
]
=
True
FEATURES
[
'ALLOW_COURSE_STAFF_GRADE_DOWNLOADS'
]
=
True
GRADES_DOWNLOAD
[
'ROOT_PATH'
]
+=
"-{}"
.
format
(
os
.
getpid
())
FINANCIAL_REPORTS
[
'ROOT_PATH'
]
+=
"-{}"
.
format
(
os
.
getpid
())
# Toggles embargo on for testing
# Toggles embargo on for testing
FEATURES
[
'EMBARGO'
]
=
True
FEATURES
[
'EMBARGO'
]
=
True
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment