From d864b452dbc794fecad2da6aa9cc550a43526a55 Mon Sep 17 00:00:00 2001 From: Rebecca Cremona Date: Wed, 23 Jan 2019 17:05:21 -0500 Subject: [PATCH 1/3] Support modern pytest and django-pytest. --- .gitignore | 1 + pytest_django_ordering/plugin.py | 13 +++++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 2861b0c..31c4534 100644 --- a/.gitignore +++ b/.gitignore @@ -44,6 +44,7 @@ nosetests.xml coverage.xml *,cover .hypothesis/ +.pytest_cache/ # Translations *.mo diff --git a/pytest_django_ordering/plugin.py b/pytest_django_ordering/plugin.py index 0e5b949..576798f 100644 --- a/pytest_django_ordering/plugin.py +++ b/pytest_django_ordering/plugin.py @@ -7,10 +7,19 @@ def pytest_collection_modifyitems(items): def get_marker_transaction(test): - marker = test.get_marker('django_db') + try: + marker = test.get_closest_marker('django_db') + except AttributeError: + # pytest < 3.6.0 + marker = test.get_marker('django_db') + if marker: validate_django_db(marker) - return marker.transaction + try: + return marker.kwargs.get("transaction") + except AttributeError: + # pytest-django < 3.3.0 + return marker.transaction return None From f2c2216f2133fc6bad4bd1155661a7b841537110 Mon Sep 17 00:00:00 2001 From: Rebecca Cremona Date: Wed, 23 Jan 2019 17:11:40 -0500 Subject: [PATCH 2/3] Don't cache packages; allow fresh dependency resolution on Travis test runs. --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 37e9f62..5e0e87a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,7 +6,6 @@ python: sudo: false -cache: pip install: make requirements script: From 174ee67eb7bda93d4870f02e55b475e38113f522 Mon Sep 17 00:00:00 2001 From: Rebecca Cremona Date: Wed, 23 Jan 2019 17:27:05 -0500 Subject: [PATCH 3/3] Allow setup.py to resolve required pytest version without interference from requirements.txt --- requirements.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/requirements.txt b/requirements.txt index 7001672..a8eeff7 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,2 @@ -flake8==3.2.1 -pytest==3.0.6 +flake8 -e .