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

Switch from nose to pytest #1400

Merged
merged 17 commits into from Jan 29, 2018

Conversation

Projects
None yet
2 participants
@noirbizarre
Member

noirbizarre commented Jan 25, 2018

This PR drop nosetests and flask-testing for pytest and some plugins.

  • use to pytest as test tool
  • drop nose & co dependencies
  • drop flask-testing
  • make all test pass
  • refactor to make use of fixture
  • expose some common tools as a pytest plugin

Most of the udata.tests.{plugin,helpers} has been extracted from existing base classes (TestCase, FrontTestCase et APITestCase) to allow new tests to make use of pytest easily (no more needs to extend udata.test.TestCase).
These base classes are now thin compatibility layers for pytest and fixtures

This (big) PR will serve as a base for more incremental test tunning (xdist, on demand fixtures, ...) but it's a required first step.

@noirbizarre noirbizarre added this to the 1.3.0 milestone Jan 25, 2018

@noirbizarre noirbizarre self-assigned this Jan 25, 2018

@noirbizarre noirbizarre changed the title from WIP Switch from nose to pytest to WIP: Switch from nose to pytest Jan 26, 2018

@noirbizarre noirbizarre changed the title from WIP: Switch from nose to pytest to Switch from nose to pytest Jan 29, 2018

@noirbizarre noirbizarre requested a review from opendatateam/etalab Jan 29, 2018

noirbizarre added a commit to noirbizarre/udata-ckan that referenced this pull request Jan 29, 2018

@abulte

abulte approved these changes Jan 29, 2018

Great work 👏 💪

for code in 200, 201, 204, 400, 401, 403, 404, 410, 500:
name = 'assert{0}'.format(code)
helper = getattr(helpers, name)
setattr(WebTestMixin, name, lambda s, r, h=helper: h(r))

This comment has been minimized.

@abulte

abulte Jan 29, 2018

Member

👌

@abulte

abulte Jan 29, 2018

Member

👌

This comment has been minimized.

@noirbizarre

noirbizarre Jan 29, 2018

Member

A good developer is a lazy one 😜

@noirbizarre

noirbizarre Jan 29, 2018

Member

A good developer is a lazy one 😜

Checks if response is an HTTP redirect to the
given location.
:param response: Flask response
:param location: relative URL path to SERVER_NAME or an absolute URL

This comment has been minimized.

@abulte

abulte Jan 29, 2018

Member

document message

@abulte

abulte Jan 29, 2018

Member

document message

This comment has been minimized.

@noirbizarre

noirbizarre Jan 29, 2018

Member

done 👍

@noirbizarre

noirbizarre Jan 29, 2018

Member

done 👍

Show outdated Hide outdated udata/tests/plugin.py Outdated

noirbizarre added a commit to noirbizarre/udata-ods that referenced this pull request Jan 29, 2018

noirbizarre added a commit to noirbizarre/udata-ods that referenced this pull request Jan 29, 2018

noirbizarre added some commits Jan 29, 2018

@noirbizarre noirbizarre merged commit e62aa53 into opendatateam:master Jan 29, 2018

3 checks passed

ci/circleci: assets Your tests passed on CircleCI!
Details
ci/circleci: dist Your tests passed on CircleCI!
Details
ci/circleci: python Your tests passed on CircleCI!
Details

@noirbizarre noirbizarre deleted the noirbizarre:pytest branch Jan 29, 2018

noirbizarre added a commit to noirbizarre/udata-ckan that referenced this pull request Jan 29, 2018

noirbizarre added a commit to noirbizarre/udata-ods that referenced this pull request Jan 29, 2018

noirbizarre added a commit to noirbizarre/udata-ods that referenced this pull request Jan 29, 2018

noirbizarre added a commit to noirbizarre/udata-ods that referenced this pull request Jan 29, 2018

noirbizarre added a commit to noirbizarre/udata-ods that referenced this pull request Jan 29, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment