-
Notifications
You must be signed in to change notification settings - Fork 580
Refactoring 2-structured-data tests to use py.test #25
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
Conversation
92efef1 to
562ab5f
Compare
2-structured-data/tests/test_crud.py
Outdated
| # created and delete them during tearDown. | ||
| self.original_create = self.model.create | ||
| @py.test.yield_fixture(params=['datastore', 'cloudsql', 'mongodb']) | ||
| def app(request, monkeypatch): |
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.
monkeypatch here looks vestigial
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.
That's a... shockingly accurate way of putting it.
|
LGTM |
|
Travis didn't fail on this particular folder, so I'm ignoring it. Will wait for @waprin to get a chance to review. |
562ab5f to
fed573e
Compare
|
@jerjou @waprin I could structure the tests like this: @py.test.yield_fixture(params=['datastore', 'cloudsql', 'mongodb'])
def app(request):
...
@py.test.yield_fixture
def model(monkeypatch, app):
...
@flaky(rerun_filter=flaky_filter)
@py.test.mark.usefixtures('app', 'model')
class TestCrudOperations(object):
def test_list(self, app, model):
...
def test_add(app):
...
def test_edit(app, model):
...
def test_delete(app, model):
...This would require only one use of |
|
Either way - as long as there's a comment alluding to the dependency used for cleanup, so future-self won't go on a refactoring spree that messes things up mysteriously :) |
|
These tests are awesome, I would just like to see the pytest magic explained. |
I think the class-layout will help with that ( Let me switch to that, I think it's all-around easier to grok. |
fed573e to
70b6c60
Compare
70b6c60 to
d1467ce
Compare
|
lgtm |
|
Woohoo. |
Refactoring 2-structured-data tests to use py.test
@waprin Note that this is being merged into the
pytest-refactorbranch, which we'll merge into master when all is done.Also, question for you: I can put all of the test functions in a class and mark the whole class as flaky. That'll keep me from having to mark each test case as flaky. Your call.