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
82ae9e77
Commit
82ae9e77
authored
Aug 12, 2013
by
Carlos Andrés Rocha
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleanup some xmodule tests imports and data directory location
parent
a7568fbf
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
54 additions
and
72 deletions
+54
-72
common/lib/xmodule/xmodule/modulestore/tests/__init__.py
+0
-10
common/lib/xmodule/xmodule/modulestore/tests/test_mongo.py
+5
-5
common/lib/xmodule/xmodule/modulestore/tests/test_xml.py
+4
-4
common/lib/xmodule/xmodule/tests/__init__.py
+13
-8
common/lib/xmodule/xmodule/tests/test_combined_open_ended.py
+16
-19
common/lib/xmodule/xmodule/tests/test_conditional.py
+3
-4
common/lib/xmodule/xmodule/tests/test_export.py
+6
-15
common/lib/xmodule/xmodule/tests/test_import.py
+5
-4
common/lib/xmodule/xmodule/tests/test_util_open_ended.py
+2
-3
No files found.
common/lib/xmodule/xmodule/modulestore/tests/__init__.py
View file @
82ae9e77
from
path
import
path
# from ~/mitx_all/mitx/common/lib/xmodule/xmodule/modulestore/tests/
# to ~/mitx_all/mitx/common/test
TEST_DIR
=
path
(
__file__
)
.
abspath
()
.
dirname
()
for
i
in
range
(
5
):
TEST_DIR
=
TEST_DIR
.
dirname
()
TEST_DIR
=
TEST_DIR
/
'test'
DATA_DIR
=
TEST_DIR
/
'data'
common/lib/xmodule/xmodule/modulestore/tests/test_mongo.py
View file @
82ae9e77
import
pymongo
from
pprint
import
pprint
from
nose.tools
import
assert_equals
,
assert_raises
,
assert_not_equals
,
assert_false
from
pprint
import
pprint
import
pymongo
from
uuid
import
uuid4
from
xblock.core
import
Scope
from
xblock.runtime
import
KeyValueStore
,
InvalidScopeError
from
xmodule.tests
import
DATA_DIR
from
xmodule.modulestore
import
Location
from
xmodule.modulestore.mongo
import
MongoModuleStore
,
MongoKeyValueStore
from
xmodule.modulestore.xml_importer
import
import_from_xml
from
.test_modulestore
import
check_path_to_location
from
.
import
DATA_DIR
from
uuid
import
uuid4
from
xmodule.modulestore.tests.test_modulestore
import
check_path_to_location
HOST
=
'localhost'
...
...
common/lib/xmodule/xmodule/modulestore/tests/test_xml.py
View file @
82ae9e77
import
os.path
from
nose.tools
import
assert_raises
from
xmodule.course_module
import
CourseDescriptor
from
xmodule.modulestore.xml
import
XMLModuleStore
from
nose.tools
import
assert_raises
from
.test_modulestore
import
check_path_to_location
from
.
import
DATA_DIR
from
xmodule.tests
import
DATA_DIR
from
xmodule.modulestore.tests.test_modulestore
import
check_path_to_location
class
TestXMLModuleStore
(
object
):
...
...
common/lib/xmodule/xmodule/tests/__init__.py
View file @
82ae9e77
...
...
@@ -7,19 +7,24 @@ Run like this:
"""
import
unittest
import
json
import
os
import
unittest
import
fs
import
fs.osfs
import
numpy
import
json
from
mock
import
Mock
from
path
import
path
import
calc
import
xmodule
from
xmodule.x_module
import
ModuleSystem
from
mock
import
Mock
from
xmodule.x_module
import
ModuleSystem
,
XModuleDescriptor
# Location of common test DATA directory
# '../../../../edx-platform/common/test/data/'
MODULE_DIR
=
path
(
__file__
)
.
dirname
()
DATA_DIR
=
path
.
joinpath
(
*
MODULE_DIR
.
splitall
()[:
-
4
])
/
'test/data/'
open_ended_grading_interface
=
{
...
...
@@ -67,7 +72,7 @@ class ModelsTest(unittest.TestCase):
pass
def
test_load_class
(
self
):
vc
=
xmodule
.
x_module
.
XModuleDescriptor
.
load_class
(
'video'
)
vc
=
XModuleDescriptor
.
load_class
(
'video'
)
vc_str
=
"<class 'xmodule.video_module.VideoDescriptor'>"
self
.
assertEqual
(
str
(
vc
),
vc_str
)
...
...
common/lib/xmodule/xmodule/tests/test_combined_open_ended.py
View file @
82ae9e77
"""
Tests for the various pieces of the CombinedOpenEndedGrading system
OpenEndedChild
OpenEndedModule
"""
from
datetime
import
datetime
import
json
from
mock
import
Mock
,
MagicMock
,
ANY
import
logging
import
unittest
from
test_util_open_ended
import
MockQueryDict
,
DummyModulestore
from
lxml
import
etree
from
mock
import
Mock
,
MagicMock
,
ANY
from
pytz
import
UTC
from
xmodule.open_ended_grading_classes.openendedchild
import
OpenEndedChild
from
xmodule.open_ended_grading_classes.open_ended_module
import
OpenEndedModule
...
...
@@ -10,30 +21,16 @@ from xmodule.open_ended_grading_classes.combined_open_ended_modulev1 import Comb
from
xmodule.open_ended_grading_classes.grading_service_module
import
GradingServiceError
from
xmodule.combined_open_ended_module
import
CombinedOpenEndedModule
from
xmodule.modulestore
import
Location
from
lxml
import
etre
e
from
xmodule.tests
import
get_test_system
,
test_util_open_ended
from
xmodule.tests.test_util_open_ended
import
MockQueryDict
,
DummyModulestor
e
import
capa.xqueue_interface
as
xqueue_interface
from
datetime
import
datetime
from
pytz
import
UTC
import
logging
log
=
logging
.
getLogger
(
__name__
)
from
.
import
get_test_system
log
=
logging
.
getLogger
(
__name__
)
ORG
=
'edX'
COURSE
=
'open_ended'
# name of directory with course data
import
test_util_open_ended
"""
Tests for the various pieces of the CombinedOpenEndedGrading system
OpenEndedChild
OpenEndedModule
"""
class
OpenEndedChildTest
(
unittest
.
TestCase
):
"""
...
...
common/lib/xmodule/xmodule/tests/test_conditional.py
View file @
82ae9e77
from
ast
import
literal_eval
import
json
import
unittest
from
fs.memoryfs
import
MemoryFS
from
ast
import
literal_eval
from
mock
import
Mock
,
patch
from
xmodule.error_module
import
NonStaffErrorDescriptor
from
xmodule.modulestore
import
Location
from
xmodule.modulestore.xml
import
ImportSystem
,
XMLModuleStore
from
xmodule.conditional_module
import
ConditionalModule
from
xmodule.tests
import
DATA_DIR
,
get_test_system
from
xmodule.tests.test_export
import
DATA_DIR
ORG
=
'test_org'
COURSE
=
'conditional'
# name of directory with course data
from
.
import
get_test_system
class
DummySystem
(
ImportSystem
):
...
...
common/lib/xmodule/xmodule/tests/test_export.py
View file @
82ae9e77
...
...
@@ -2,28 +2,19 @@
Tests of XML export
"""
from
datetime
import
datetime
,
timedelta
,
tzinfo
from
tempfile
import
mkdtemp
import
unittest
import
pytz
import
shutil
from
datetime
import
datetime
,
timedelta
,
tzinfo
import
pytz
from
fs.osfs
import
OSFS
from
path
import
path
from
tempfile
import
mkdtemp
import
shutil
from
xmodule.modulestore
import
Location
from
xmodule.modulestore.xml
import
XMLModuleStore
from
xmodule.modulestore.xml_exporter
import
EdxJSONEncoder
from
xmodule.modulestore
import
Location
# from ~/mitx_all/mitx/common/lib/xmodule/xmodule/tests/
# to ~/mitx_all/mitx/common/test
TEST_DIR
=
path
(
__file__
)
.
abspath
()
.
dirname
()
for
i
in
range
(
4
):
TEST_DIR
=
TEST_DIR
.
dirname
()
TEST_DIR
=
TEST_DIR
/
'test'
DATA_DIR
=
TEST_DIR
/
'data'
from
xmodule.tests
import
DATA_DIR
def
strip_filenames
(
descriptor
):
...
...
common/lib/xmodule/xmodule/tests/test_import.py
View file @
82ae9e77
# -*- coding: utf-8 -*-
import
datetime
import
unittest
from
fs.memoryfs
import
MemoryFS
from
fs.memoryfs
import
MemoryFS
from
lxml
import
etree
from
mock
import
Mock
,
patch
from
django.utils.timezone
import
UTC
from
xmodule.xml_module
import
is_pointer_tag
from
xmodule.modulestore
import
Location
from
xmodule.modulestore.xml
import
ImportSystem
,
XMLModuleStore
from
xmodule.modulestore.inheritance
import
compute_inherited_metadata
from
xmodule.fields
import
Date
from
xmodule.tests
import
DATA_DIR
from
.test_export
import
DATA_DIR
import
datetime
from
django.utils.timezone
import
UTC
ORG
=
'test_org'
COURSE
=
'test_course'
...
...
common/lib/xmodule/xmodule/tests/test_util_open_ended.py
View file @
82ae9e77
from
.
import
get_test_system
from
xmodule.modulestore
import
Location
from
xmodule.modulestore.xml
import
XMLModuleStore
from
xmodule.tests
.test_export
import
DATA_DIR
from
xmodule.tests
import
DATA_DIR
,
get_test_system
OPEN_ENDED_GRADING_INTERFACE
=
{
'url'
:
'blah/'
,
...
...
@@ -42,7 +41,7 @@ class DummyModulestore(object):
def
setup_modulestore
(
self
,
name
):
self
.
modulestore
=
XMLModuleStore
(
DATA_DIR
,
course_dirs
=
[
name
])
def
get_course
(
self
,
name
):
def
get_course
(
self
,
_
):
"""Get a test course by directory name. If there's more than one, error."""
courses
=
self
.
modulestore
.
get_courses
()
return
courses
[
0
]
...
...
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