-
Notifications
You must be signed in to change notification settings - Fork 14.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[fix] tox running of specific tests #9097
[fix] tox running of specific tests #9097
Conversation
Codecov Report
@@ Coverage Diff @@
## master #9097 +/- ##
=========================================
- Coverage 59.15% 59.1% -0.06%
=========================================
Files 370 372 +2
Lines 11818 11920 +102
Branches 2900 2918 +18
=========================================
+ Hits 6991 7045 +54
- Misses 4648 4693 +45
- Partials 179 182 +3
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for fixing this @john-bodley , I was wondering why I wasn't able to run only a subset of tests a few weeks ago but didn't look into it. I'm sure this was working before; any idea if this is a regression from a code change or perhaps a consequence of bumping tox
or similar?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👏 this was driving me crazy last week
e481005
to
6f3b0dc
Compare
@villebro I believe the regression was introduced in #8418 though without the I've augmented the commit to include missing imports as running certain individual files would fail with the familiar app context error. It seems that the test suite worked merely because the first test alphabetically imported the correct file. |
6f3b0dc
to
8a399db
Compare
@@ -19,7 +19,7 @@ commands = | |||
{toxinidir}/superset/bin/superset db upgrade | |||
{toxinidir}/superset/bin/superset init | |||
nosetests tests/load_examples_test.py | |||
nosetests -e load_examples_test tests {posargs} | |||
nosetests --exclude=load_examples_test {posargs:tests} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-e
and --exclude=
are equivalent, though I though --exclude
was more descriptive.
CATEGORY
Choose one
SUMMARY
This PR corrects running of specific tests in
tox
, i.e.,whereas previously this would have run as,
meaning the entire test suite was run prior to the test(s) for interest.
tox
provides a mechanism for default positional arguments (per here) and thus these are equivalent (the first being the default) for running the entire suite:Note when running individual tests I ran into the
RuntimeError: Working outside of application context.
error during the import phase. The fix is to add theimport tests.test_app
import (which creates the app context) where necessary. I believe the entire test suite worked only because the first file alphabetically included the import.BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
TEST PLAN
ADDITIONAL INFORMATION
REVIEWERS
to: craig-rueda @etr2460 @mistercrunch @villebro