-
Notifications
You must be signed in to change notification settings - Fork 148
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
Update test suite #82
Conversation
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.
Hey @rpkilby, this is amazing, thank you so much! I've only left a single comment/question, otherwise looks great.
Added a dedicated packaging build. Can discuss further, but you need either a coverage or packaging-specific build.
What is the "packaging build"? Is it something tox-specific? Why is it needed?
'nose', | ||
'coverage', | ||
'Django >= 1.5', | ||
'Django', |
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.
Can you please move the Django requirement back to "tests_require" so it's still optional? Rules should be able to be used standalone without Django.
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.
Right. Should I just remove it entirely then? The tests_require
isn't used by tox.
Sorry - to be clear, I'm suggesting that tests_require
isn't necessary, since tests are ran through tox
, not python setup.py test
.
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.
Gotcha. Let’s remove it completely then.
Sorry - this requires a bit of context. One of the common problems with projects is that they aren't actually testing their built distributions (the
If I execute the below, am I testing the installed distribution (via $ python3 -m venv .venv
$ source .venv/bin/activate
$ pip install .
$ python runtests.py It's the latter. Python inserts the script's directory as the first item in the
So, how do we fix this? Basically, make the local package directory not directly importable by the test script. Either move the package code into an intermediate directory, such as Now that How do we fix coverage? By using an editable install. An editable install symlinks to However, by using an editable install, we go back to the original issue - we're not testing the distribution. In general, the test matrix either needs to prioritize testing the package's distribution, or testing with coverage enabled. You then need either a specialized tl;dr, this isn't tox-specific, most projects don't properly test their build artifacts ( |
Hi @dfunckt - did you have any additional questions/concerns about the PR? I'm planning on working on a few additional features/fixes, but am waiting for this to be merged first, given how many files this PR affects. In general, my goal is to get django-rules up-to-date, so that we can replace django-guardian in the DRF test suite with django-rules (django-guardian integration has been split into a separate package). |
Hey @rpkilby — the PR looks great. I’d like to add a couple of things in the rules 1.x line before merging this to start 2.x and I just didn’t get round to it yet unfortunately. It’s on my radar though, I haven’t forgotten. It seems you’re blocked, what you can do is base your next PR on this branch instead of master to get going and I’ll make sure master catches up soon. |
Django 2.1rc1 is out. Final Django 2.1 will be released in less than 12 days based on https://code.djangoproject.com/wiki/Version2.1Roadmap ... Looks like django-rules will not work without fixes for Django 2.1. And fixes will require us to drop old Django versions... ( I created issue #74 ) |
@rpkilby this PR landed in c7c1d32 -- rebased, with slight modifications. This and a few other things are released as rules 2.0. Thank you very much for this, great stuff :) cc @lorddaedra |
Hi @dfunckt. Taking a stab at resolving #76 and #75. Happy to go into more detail if you have questions about choices/changes. This also supersedes/closes #52.
TestData
mixin.runtests.py
script, tox now just callsmanage.py test
directly.tests
directories to thePYTHONPATH
, since the script's (manage.py) directory is automatically inserted, and tox will install therules
into the test env.