-
Notifications
You must be signed in to change notification settings - Fork 430
Migrate test runner to py.test #569
Migrate test runner to py.test #569
Conversation
We can probably just rip off the App Engine stuff from here into a conftest.py for the appengine things. (it's not a lot of code) |
define these on set up. | ||
""" | ||
global Signer | ||
global Verifier |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
@jonparrott Should we worry about populating the |
2e5b8cb
to
16ce742
Compare
There is a bug in the 0.9 release of I've already created an issue for it. |
@pferate if we need app engine stuff to work (which we do) we might as well populate conftest.py just for that. You only need a subset of the stuff in the example I linked. |
I copied the code from App Engine file you linked. I moved the imports within I just added the fixture code for this PR to These will be expanded more when we transition the tests here to fixtures. |
pass | ||
|
||
|
||
def import_appengine_config(): |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Please don't merge this until after the 3.0.0 release. I'll remove the label when it's safe. |
v3.0.0 is released so this can now be considered for merging. |
Should there be a 4.x or Dev branch, so that they can be kept separate from 3.x updates? |
I don't think so, but @nathanielmanistaatgoogle is welcome to overrule that. |
|
||
# Fixes timezone and other os-level items. | ||
import google.appengine.tools.os_compat | ||
(google.appengine.tools.os_compat) |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Rebased onto master. Thanks for the help @jonparrott! |
Return True to skip collection. Skips App Engine tests when --gae-sdk | ||
is not specified. | ||
""" | ||
if 'contrib/appengine' in str(path): |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Looks mostly good; just that one comment. |
@jonparrott, with us moving the app engine tests into their own directory, should we move the app engine modules into their own directory as well? Another coupled set of files are |
I don't think so. There's no hard and fast rule that tests must be organized exactly as their module-under-test. I think defaulting to that but making exceptions where it makes testing easier (like we did here) makes sense. Practicality beats purity. |
set_up_gae_environment(config.getoption('gae_sdk')) | ||
|
||
|
||
def pytest_ignore_collect(path, config): |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
@nathanielmanistaatgoogle: PR updated, PTAL. |
|
||
def pytest_ignore_collect(path, config): | ||
"""Direct py.test to skip App Engine tests when --gae-sdk is not specified. | ||
|
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
One last tweak; sorry. |
PR updated. @nathanielmanistaatgoogle PTAL. |
What's with that test failure? Is it desired that this go in as two commits? (No pushing in either direction; just want to confirm.) |
Looks like it may be related to #590. This is what is in my Travis logs:
In my repo, As for the commits, one was a merged PR from @jonparrott helping me sort out some of the GAE tests, so I didn't want to lose his work within mine. Functionally, they could be squashed. |
The pypy failure is my fault. We probably just need to check for the non-existence of {$HOME}/.pyenv before doing the git clone. We can do it in this PR or I can send a separate one. |
Separate pull request with the fix in isolation, please. |
@pferate It's fixed, rebase and try again? |
Migrating test runner from `unittest2`/`nose` to `pytest`. The pytest runner is also compatible with both unittest and nose tests. Some of the benefits of PyTest include: * using plain asserts * function-based fixtures instead of setUp and tearDown * no strange camelCase methods
fe201ff
to
e80dd38
Compare
@jonparrott Rebased and waiting on Travis. One weird thing that I've been seeing recently is The 2 linked Travis jobs are from the same commit from yesterday. It looks like my fork is collecting the django tests (it shouldn't) and the main repo correctly skips them. Before I dig much further, do you have any idea of what's going on? As long as it passes on the main repo, it doesn't really matter; but this seems strange. |
@pferate: are you waiting for answers from @jonparrott before this gets merged? (I am completely fine with the pull request content and metadata; feel free to merge when conversation is again concluded.) |
No need to wait. I just had some weird, unique test results that I'm trying to figure out on my end. |
Maintainer of pytest_gae needs to merge open PR and push to PyPI.
In the mean time, get code directly from GitHub mirror.