Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
edx-platform-release
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Hsin-Yu Chien
edx-platform-release
Commits
71bc1476
Commit
71bc1476
authored
9 years ago
by
Christine Lytwynec
Browse files
Options
Downloads
Patches
Plain Diff
start paver quality tests with clean paver task environment
parent
657f1563
Loading
Loading
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
pavelib/paver_tests/test_paver_quality.py
+16
-2
16 additions, 2 deletions
pavelib/paver_tests/test_paver_quality.py
with
16 additions
and
2 deletions
pavelib/paver_tests/test_paver_quality.py
+
16
−
2
View file @
71bc1476
...
...
@@ -9,6 +9,7 @@ from ddt import ddt, file_data
import
pavelib.quality
import
paver.easy
import
paver.tasks
from
paver.easy
import
BuildFailure
...
...
@@ -63,6 +64,19 @@ class TestPaverRunQuality(unittest.TestCase):
def
setUp
(
self
):
super
(
TestPaverRunQuality
,
self
).
setUp
()
# test_no_diff_quality_failures seems to alter the way that paver
# executes these lines is subsequent tests.
# https://github.com/paver/paver/blob/master/paver/tasks.py#L175-L180
#
# The other tests don't appear to have the same impact. This was
# causing a test order dependency. This line resets that state
# of environment._task_in_progress so that the paver commands in the
# tests will be considered top level tasks by paver, and we can predict
# which path it will chose in the above code block.
#
# TODO: Figure out why one test is altering the state to begin with.
paver
.
tasks
.
environment
=
paver
.
tasks
.
Environment
()
# mock the @needs decorator to skip it
self
.
_mock_paver_needs
=
patch
.
object
(
pavelib
.
quality
.
run_quality
,
'
needs
'
).
start
()
self
.
_mock_paver_needs
.
return_value
=
0
...
...
@@ -80,7 +94,6 @@ class TestPaverRunQuality(unittest.TestCase):
_mock_pep8_violations
=
MagicMock
(
return_value
=
(
1
,
[
'
lms/envs/common.py:32:2: E225 missing whitespace around operator
'
])
)
with
patch
(
'
pavelib.quality._get_pep8_violations
'
,
_mock_pep8_violations
):
with
self
.
assertRaises
(
SystemExit
):
pavelib
.
quality
.
run_quality
(
""
)
...
...
@@ -117,8 +130,9 @@ class TestPaverRunQuality(unittest.TestCase):
pylint should not be run
"""
self
.
_mock_paver_sh
.
side_effect
=
[
Exception
(
'
unrecognized failure!
'
),
0
]
with
self
.
assertRaises
(
Exception
):
with
self
.
assertRaises
(
SystemExit
):
pavelib
.
quality
.
run_quality
(
""
)
self
.
assertRaises
(
Exception
)
# Test that pylint is NOT called by counting calls
self
.
assertEqual
(
self
.
_mock_paver_sh
.
call_count
,
1
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment