Skip to content

Commit

Permalink
* Fixes compatibility issues with pytest 4.0.0
Browse files Browse the repository at this point in the history
* Tests included in the source distribution as requested in #35
  • Loading branch information
jbasko committed Nov 16, 2018
1 parent cea8ebd commit c6bb5ac
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 11 deletions.
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
include LICENSE
include README.rst
graft tests

recursive-exclude * __pycache__
recursive-exclude * *.py[co]
8 changes: 7 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Installation:

$ pip install pytest-random-order

From v1.0.0 onwards, this plugin no longer randomises tests by default. To enable randomisation, you have to run
From v1.0.0 onwards, **this plugin no longer randomises tests by default**. To enable randomisation, you have to run
pytest in one of the following ways:

::
Expand Down Expand Up @@ -233,6 +233,12 @@ from being registered so its hooks won't be registered and its command line opti
Changelog
--------------

v1.0.3 (2018-11-16)
+++++++++++++++++++

* Fixes compatibility issues with pytest 4.0.0, works with pytest 3.0+ as before.
* Tests included in the source distribution.

v1.0.0 (2018-10-20)
+++++++++++++++++++

Expand Down
8 changes: 7 additions & 1 deletion random_order/plugin.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import random
import sys
import traceback
import warnings

import pytest

from random_order.bucket_types import bucket_type_keys, bucket_types
from random_order.cache import process_failed_first_last_failed
Expand Down Expand Up @@ -78,7 +81,10 @@ def pytest_collection_modifyitems(session, config, items):
failure = 'pytest-random-order plugin has failed with {0!r}:\n{1}'.format(
e, ''.join(traceback.format_tb(exc_tb, 10))
)
config.warn(0, failure, None)
if not hasattr(pytest, "PytestWarning"):
config.warn(0, failure, None)
else:
warnings.warn(pytest.PytestWarning(failure))

finally:
# Fail only if we have lost user's tests
Expand Down
5 changes: 4 additions & 1 deletion random_order/shuffler.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,10 @@ def _get_set_of_item_ids(items):


def _disable(item, session):
marker = item.get_marker('random_order')
if hasattr(item, 'get_closest_marker'):
marker = item.get_closest_marker('random_order')
else:
marker = item.get_marker('random_order')
if marker:
is_disabled = marker.kwargs.get('disabled', False)
if is_disabled:
Expand Down
13 changes: 5 additions & 8 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def read(fname):

setup(
name='pytest-random-order',
version='1.0.2',
version='1.0.3',
author='Jazeps Basko',
author_email='[email protected]',
maintainer='Jazeps Basko',
Expand All @@ -23,16 +23,13 @@ def read(fname):
url='https://github.com/jbasko/pytest-random-order',
description='Randomise the order in which pytest tests are run with some control over the randomness',
long_description=read('README.rst'),
py_modules=[
'random_order.bucket_types',
'random_order.cache',
'random_order.config',
'random_order.plugin',
'random_order.shuffler',
packages=[
'random_order',
],
include_package_data=True,
python_requires=">=3.5.0",
install_requires=[
'pytest>=2.9.2',
'pytest>=3.0.0',
],
classifiers=[
'Development Status :: 5 - Production/Stable',
Expand Down

0 comments on commit c6bb5ac

Please sign in to comment.