Skip to content

tests: cover and fix handling of optionals #6041

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

Closed
wants to merge 4 commits into from

Conversation

blueyed
Copy link
Contributor

@blueyed blueyed commented Jun 21, 2018

Taken out of #6038.

@blueyed
Copy link
Contributor Author

blueyed commented Jun 21, 2018

Increases coverage like expected: https://codecov.io/gh/encode/django-rest-framework/pull/6041 (+0.15%).

@rpkilby
Copy link
Member

rpkilby commented Jun 21, 2018

Hm. On the one hand, testing the optional requirements is The Correct Thing To Do TM. On the other, optionals would now only be tested against one version of python.

Maybe we should test the inverse? eg, a base build that excludes optionals.

@blueyed
Copy link
Contributor Author

blueyed commented Jun 21, 2018

Maybe we should test the inverse? eg, a base build that excludes optionals.

Agreed.
That is a bit funky to do in tox however - since [testenv] should be kept as base (unlike with dist and dist-base):

diff --git i/tox.ini w/tox.ini
index 5749fd6c..49e27b0d 100644
--- i/tox.ini
+++ w/tox.ini
@@ -21,24 +21,25 @@ envdir = {toxworkdir}/venvs/{envname}
 setenv =
        PYTHONDONTWRITEBYTECODE=1
        PYTHONWARNINGS=once
+       base: _DRF_TESTS_OPTIONAL_DEPS=
 deps =
         django110: Django>=1.10,<1.11
         django111: Django>=1.11,<2.0
         django20: Django>=2.0,<2.1
         django21: Django>=2.1b1,<2.2
         djangomaster: https://github.com/django/django/archive/master.tar.gz
-        optionals: -rrequirements/requirements-optionals.txt
+        {env:_DRF_TESTS_OPTIONAL_DEPS:-rrequirements/requirements-optionals.txt}
         -rrequirements/requirements-testing.txt
 
-[testenv:dist]
+[testenv:dist-base]
 commands = ./runtests.py --fast {posargs} --no-pkgroot --staticfiles -rw
 deps =
         django
         -rrequirements/requirements-testing.txt
 
-[testenv:dist-optionals]
-commands = {[testenv:dist]commands}
-deps = {[testenv:dist]deps}
+[testenv:dist]
+commands = {[testenv:dist-base]commands}
+deps = {[testenv:dist-base]deps}
         -rrequirements/requirements-optionals.txt
 
 [testenv:lint]

@blueyed
Copy link
Contributor Author

blueyed commented Jun 21, 2018

Pushed a squash-up (for the first commit really, unlike it currently says).

OTOH build time likely is better with base-by-default.. ;)

@rpkilby
Copy link
Member

rpkilby commented Jun 21, 2018

Hi @blueyed - closing this in favor of #6047, which modifies the tox/travis for this PR.

@rpkilby rpkilby closed this Jun 21, 2018
@blueyed
Copy link
Contributor Author

blueyed commented Jun 21, 2018

You could also have pushed fixups to this PR - would have helped to keep discussion/review in one place.

@blueyed
Copy link
Contributor Author

blueyed commented Jun 21, 2018

Oh, "Allow edits from maintainers." was not ticked (but have done so now).
Anyway, let's follow up on #6047 then.

@blueyed blueyed deleted the cover-optionals branch June 21, 2018 20:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants