Skip to content

Commit c6bb5ac

Browse files
committed
* Fixes compatibility issues with pytest 4.0.0
* Tests included in the source distribution as requested in #35
1 parent cea8ebd commit c6bb5ac

File tree

5 files changed

+24
-11
lines changed

5 files changed

+24
-11
lines changed

MANIFEST.in

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
include LICENSE
22
include README.rst
3+
graft tests
34

45
recursive-exclude * __pycache__
56
recursive-exclude * *.py[co]

README.rst

+7-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Installation:
2828

2929
$ pip install pytest-random-order
3030

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

3434
::
@@ -233,6 +233,12 @@ from being registered so its hooks won't be registered and its command line opti
233233
Changelog
234234
--------------
235235

236+
v1.0.3 (2018-11-16)
237+
+++++++++++++++++++
238+
239+
* Fixes compatibility issues with pytest 4.0.0, works with pytest 3.0+ as before.
240+
* Tests included in the source distribution.
241+
236242
v1.0.0 (2018-10-20)
237243
+++++++++++++++++++
238244

random_order/plugin.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import random
22
import sys
33
import traceback
4+
import warnings
5+
6+
import pytest
47

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

8389
finally:
8490
# Fail only if we have lost user's tests

random_order/shuffler.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,10 @@ def _get_set_of_item_ids(items):
101101

102102

103103
def _disable(item, session):
104-
marker = item.get_marker('random_order')
104+
if hasattr(item, 'get_closest_marker'):
105+
marker = item.get_closest_marker('random_order')
106+
else:
107+
marker = item.get_marker('random_order')
105108
if marker:
106109
is_disabled = marker.kwargs.get('disabled', False)
107110
if is_disabled:

setup.py

+5-8
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def read(fname):
1414

1515
setup(
1616
name='pytest-random-order',
17-
version='1.0.2',
17+
version='1.0.3',
1818
author='Jazeps Basko',
1919
author_email='[email protected]',
2020
maintainer='Jazeps Basko',
@@ -23,16 +23,13 @@ def read(fname):
2323
url='https://github.com/jbasko/pytest-random-order',
2424
description='Randomise the order in which pytest tests are run with some control over the randomness',
2525
long_description=read('README.rst'),
26-
py_modules=[
27-
'random_order.bucket_types',
28-
'random_order.cache',
29-
'random_order.config',
30-
'random_order.plugin',
31-
'random_order.shuffler',
26+
packages=[
27+
'random_order',
3228
],
29+
include_package_data=True,
3330
python_requires=">=3.5.0",
3431
install_requires=[
35-
'pytest>=2.9.2',
32+
'pytest>=3.0.0',
3633
],
3734
classifiers=[
3835
'Development Status :: 5 - Production/Stable',

0 commit comments

Comments
 (0)