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
a01fbefc
Commit
a01fbefc
authored
Sep 17, 2014
by
Ben Patterson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor default_store logic in paver test_bokchoy
parent
23da87f0
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
32 deletions
+30
-32
pavelib/bok_choy.py
+9
-16
pavelib/paver_tests/test_paver_bok_choy_cmds.py
+20
-15
pavelib/utils/test/suites/bokchoy_suite.py
+1
-1
No files found.
pavelib/bok_choy.py
View file @
a01fbefc
...
...
@@ -52,7 +52,7 @@ def test_bokchoy(options):
opts
=
{
'test_spec'
:
getattr
(
options
,
'test_spec'
,
None
),
'fasttest'
:
getattr
(
options
,
'fasttest'
,
False
),
'default_store'
:
getattr
(
options
,
'default_store'
,
None
),
'default_store'
:
getattr
(
options
,
'default_store'
,
'split'
),
'verbosity'
:
getattr
(
options
,
'verbosity'
,
2
),
'extra_args'
:
getattr
(
options
,
'extra_args'
,
''
),
'test_dir'
:
'tests'
,
...
...
@@ -78,8 +78,8 @@ def perf_report_bokchoy(options):
opts
=
{
'test_spec'
:
getattr
(
options
,
'test_spec'
,
None
),
'fasttest'
:
getattr
(
options
,
'fasttest'
,
False
),
'default_store'
:
getattr
(
options
,
'default_store'
,
'split'
),
'imports_dir'
:
getattr
(
options
,
'imports_dir'
,
None
),
'default_store'
:
getattr
(
options
,
'default_store'
,
None
),
'verbosity'
:
getattr
(
options
,
'verbosity'
,
2
),
'test_dir'
:
'performance'
,
'ptests'
:
True
,
...
...
@@ -90,22 +90,15 @@ def perf_report_bokchoy(options):
def
run_bokchoy
(
**
opts
):
"""
Runs BokChoyTestSuite with the given options.
If a default store is not specified, runs the test suite for 'split' as the default store.
"""
if
opts
[
'default_store'
]
not
in
[
'draft'
,
'split'
]:
msg
=
colorize
(
'red'
,
'No modulestore specified, running tests for split.'
test_suite
=
BokChoyTestSuite
(
'bok-choy'
,
**
opts
)
msg
=
colorize
(
'green'
,
'Running tests using {default_store} modulestore.'
.
format
(
default_store
=
test_suite
.
default_store
)
)
print
(
msg
)
stores
=
[
'split'
]
else
:
stores
=
[
opts
[
'default_store'
]]
for
store
in
stores
:
opts
[
'default_store'
]
=
store
test_suite
=
BokChoyTestSuite
(
'bok-choy'
,
**
opts
)
test_suite
.
run
()
print
(
msg
)
test_suite
.
run
()
@task
...
...
pavelib/paver_tests/test_paver_bok_choy_cmds.py
View file @
a01fbefc
...
...
@@ -6,26 +6,23 @@ from pavelib.utils.test.suites.bokchoy_suite import BokChoyTestSuite
REPO_DIR
=
os
.
getcwd
()
class
TestPaverBokChoy
(
unittest
.
TestCase
):
class
TestPaverBokChoy
Cmd
(
unittest
.
TestCase
):
def
setUp
(
self
):
self
.
request
=
BokChoyTestSuite
(
''
)
def
_expected_command
(
self
,
expected_text_append
):
def
_expected_command
(
self
,
expected_text_append
,
expected_default_store
=
None
):
if
expected_text_append
:
expected_text_append
=
"/"
+
expected_text_append
expected_statement
=
(
"DEFAULT_STORE=None SCREENSHOT_DIR='{repo_dir}/test_root/log' "
"BOK_CHOY_HAR_DIR='{repo_dir}/test_root/log/hars' "
"SELENIUM_DRIVER_LOG_DIR='{repo_dir}/test_root/log' "
"nosetests {repo_dir}/common/test/acceptance/tests{exp_text} "
"--with-xunit "
"--xunit-file={repo_dir}/reports/bok_choy/xunit.xml "
"--verbosity=2 "
.
format
(
repo_dir
=
REPO_DIR
,
exp_text
=
expected_text_append
,
)
)
expected_statement
=
(
"DEFAULT_STORE={default_store} SCREENSHOT_DIR='{repo_dir}/test_root/log' "
"BOK_CHOY_HAR_DIR='{repo_dir}/test_root/log/hars' "
"SELENIUM_DRIVER_LOG_DIR='{repo_dir}/test_root/log' "
"nosetests {repo_dir}/common/test/acceptance/tests{exp_text} "
"--with-xunit "
"--xunit-file={repo_dir}/reports/bok_choy/xunit.xml "
"--verbosity=2 "
.
format
(
default_store
=
expected_default_store
,
repo_dir
=
REPO_DIR
,
exp_text
=
expected_text_append
))
return
expected_statement
def
test_default_bokchoy
(
self
):
...
...
@@ -43,5 +40,13 @@ class TestPaverBokChoy(unittest.TestCase):
self
.
request
.
test_spec
=
"test_foo.py:FooTest.test_bar"
self
.
assertEqual
(
self
.
request
.
cmd
,
self
.
_expected_command
(
self
.
request
.
test_spec
))
def
test_default_bokchoy_with_split_default_store
(
self
):
self
.
request
.
test_spec
=
"test_foo.py"
self
.
request
.
default_store
=
"draft"
self
.
assertEqual
(
self
.
request
.
cmd
,
self
.
_expected_command
(
self
.
request
.
test_spec
,
"draft"
))
# TODO: Test when bok_choy test file is in a subdir
def
test_default_bokchoy_with_invalid_default_store
(
self
):
# the cmd will dumbly compose whatever we pass in for the default_store
self
.
request
.
test_spec
=
"test_foo.py"
self
.
request
.
default_store
=
"invalid"
self
.
assertEqual
(
self
.
request
.
cmd
,
self
.
_expected_command
(
self
.
request
.
test_spec
,
"invalid"
))
pavelib/utils/test/suites/bokchoy_suite.py
View file @
a01fbefc
...
...
@@ -28,7 +28,7 @@ class BokChoyTestSuite(TestSuite):
self
.
cache
=
Env
.
BOK_CHOY_CACHE
self
.
fasttest
=
kwargs
.
get
(
'fasttest'
,
False
)
self
.
test_spec
=
kwargs
.
get
(
'test_spec'
,
None
)
self
.
default_store
=
kwargs
.
get
(
'default_store'
)
self
.
default_store
=
kwargs
.
get
(
'default_store'
,
None
)
self
.
verbosity
=
kwargs
.
get
(
'verbosity'
,
2
)
self
.
extra_args
=
kwargs
.
get
(
'extra_args'
,
''
)
self
.
ptests
=
kwargs
.
get
(
'ptests'
,
False
)
...
...
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