Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
History
=======

* Fix deprecation warning from importlib-metadata 3.9.0+.

Thanks to Dominic Davis-Foster for report in `Issue #333
<https://github.com/pytest-dev/pytest-randomly/issue/333>`__.

* Stop distributing tests to reduce package size. Tests are not intended to be
run outside of the tox setup in the repository. Repackagers can use GitHub's
tarballs per tag.
Expand Down
8 changes: 6 additions & 2 deletions requirements/py36.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ attrs==20.3.0 \
--hash=sha256:31b2eced602aa8423c2aea9c76a724617ed67cf9513173fd3a4f03e3a929c7e6 \
--hash=sha256:832aa3cde19744e49938b91fea06d69ecb9e649c93ba974535d08ad92164f700
# via pytest
backports.entry-points-selectable==1.0.2 ; python_version < "3.10" \
--hash=sha256:1817925560c765efe73fb692c047fb007511388d53e6dbeec7bfcda391eb83ac \
--hash=sha256:98b9fda50dab4f298f646bc7b717b6a3b90dd4d509015f1ce9e66b41a1330d46
# via -r requirements.in
execnet==1.8.0 \
--hash=sha256:7a13113028b1e1cc4c6492b28098b3c6576c9dccc7973bfe47b342afadafb2ac \
--hash=sha256:b73c5565e517f24b62dea8a5ceac178c661c4309d3aa0c3e420856c072c411b4
Expand All @@ -26,11 +30,11 @@ faker==6.6.3 \
# via
# -r requirements.in
# factory-boy
importlib-metadata==3.8.1 ; python_version < "3.8" \
importlib-metadata==3.8.1 \
--hash=sha256:eb83dfc8d87a64d42fb2904312d632bb8d57e47c5b435f8d4d5523d2b0efc3d0 \
--hash=sha256:fc605f818ff2389df65d893ccefcd5310678c48c2855c42619464ed48556ff08
# via
# -r requirements.in
# backports.entry-points-selectable
# pluggy
# pytest
iniconfig==1.1.1 \
Expand Down
8 changes: 6 additions & 2 deletions requirements/py37.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ attrs==20.3.0 \
--hash=sha256:31b2eced602aa8423c2aea9c76a724617ed67cf9513173fd3a4f03e3a929c7e6 \
--hash=sha256:832aa3cde19744e49938b91fea06d69ecb9e649c93ba974535d08ad92164f700
# via pytest
backports.entry-points-selectable==1.0.2 ; python_version < "3.10" \
--hash=sha256:1817925560c765efe73fb692c047fb007511388d53e6dbeec7bfcda391eb83ac \
--hash=sha256:98b9fda50dab4f298f646bc7b717b6a3b90dd4d509015f1ce9e66b41a1330d46
# via -r requirements.in
execnet==1.8.0 \
--hash=sha256:7a13113028b1e1cc4c6492b28098b3c6576c9dccc7973bfe47b342afadafb2ac \
--hash=sha256:b73c5565e517f24b62dea8a5ceac178c661c4309d3aa0c3e420856c072c411b4
Expand All @@ -26,11 +30,11 @@ faker==6.6.3 \
# via
# -r requirements.in
# factory-boy
importlib-metadata==3.8.1 ; python_version < "3.8" \
importlib-metadata==3.8.1 \
--hash=sha256:eb83dfc8d87a64d42fb2904312d632bb8d57e47c5b435f8d4d5523d2b0efc3d0 \
--hash=sha256:fc605f818ff2389df65d893ccefcd5310678c48c2855c42619464ed48556ff08
# via
# -r requirements.in
# backports.entry-points-selectable
# pluggy
# pytest
iniconfig==1.1.1 \
Expand Down
4 changes: 4 additions & 0 deletions requirements/py38.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ attrs==20.3.0 \
--hash=sha256:31b2eced602aa8423c2aea9c76a724617ed67cf9513173fd3a4f03e3a929c7e6 \
--hash=sha256:832aa3cde19744e49938b91fea06d69ecb9e649c93ba974535d08ad92164f700
# via pytest
backports.entry-points-selectable==1.0.2 ; python_version < "3.10" \
--hash=sha256:1817925560c765efe73fb692c047fb007511388d53e6dbeec7bfcda391eb83ac \
--hash=sha256:98b9fda50dab4f298f646bc7b717b6a3b90dd4d509015f1ce9e66b41a1330d46
# via -r requirements.in
execnet==1.8.0 \
--hash=sha256:7a13113028b1e1cc4c6492b28098b3c6576c9dccc7973bfe47b342afadafb2ac \
--hash=sha256:b73c5565e517f24b62dea8a5ceac178c661c4309d3aa0c3e420856c072c411b4
Expand Down
4 changes: 4 additions & 0 deletions requirements/py39.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ attrs==20.3.0 \
--hash=sha256:31b2eced602aa8423c2aea9c76a724617ed67cf9513173fd3a4f03e3a929c7e6 \
--hash=sha256:832aa3cde19744e49938b91fea06d69ecb9e649c93ba974535d08ad92164f700
# via pytest
backports.entry-points-selectable==1.0.2 ; python_version < "3.10" \
--hash=sha256:1817925560c765efe73fb692c047fb007511388d53e6dbeec7bfcda391eb83ac \
--hash=sha256:98b9fda50dab4f298f646bc7b717b6a3b90dd4d509015f1ce9e66b41a1330d46
# via -r requirements.in
execnet==1.8.0 \
--hash=sha256:7a13113028b1e1cc4c6492b28098b3c6576c9dccc7973bfe47b342afadafb2ac \
--hash=sha256:b73c5565e517f24b62dea8a5ceac178c661c4309d3aa0c3e420856c072c411b4
Expand Down
2 changes: 1 addition & 1 deletion requirements/requirements.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
backports.entry-points-selectable ; python_version < "3.10"
factory_boy
faker
importlib-metadata ; python_version < "3.8"
numpy
pytest
pytest-xdist
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ package_dir=
py_modules = pytest_randomly
include_package_data = True
install_requires =
importlib-metadata ; python_version < "3.8"
backports.entry-points-selectable ; python_version < "3.10"
pytest
python_requires = >=3.6
zip_safe = False
Expand Down
11 changes: 4 additions & 7 deletions src/pytest_randomly.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
import argparse
import hashlib
import random
import sys

# if sys.version_info < (3, 10):
from backports.entry_points_selectable import entry_points
from pytest import Collector, fixture

if sys.version_info >= (3, 8):
from importlib.metadata import entry_points
else:
from importlib_metadata import entry_points

try:
import xdist
except ImportError:
Expand Down Expand Up @@ -150,7 +146,8 @@ def _reseed(config, offset=0):

if entrypoint_reseeds is None:
entrypoint_reseeds = [
e.load() for e in entry_points().get("pytest_randomly.random_seeder", [])
e.load()
for e in entry_points().select(group="pytest_randomly.random_seeder")
]
for reseed in entrypoint_reseeds:
reseed(seed)
Expand Down
9 changes: 5 additions & 4 deletions tests/test_pytest_randomly.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from types import SimpleNamespace
from unittest.mock import Mock

import pytest
Expand Down Expand Up @@ -675,10 +676,10 @@ def load(self):
entry_points = []

def fake_entry_points():
return {
"pytest_randomly.random_seeder": entry_points,
"ignore": lambda x: 1 / 0,
}
return SimpleNamespace(select=fake_select)

def fake_select(*, group):
return entry_points

monkeypatch.setattr(pytest_randomly, "entry_points", fake_entry_points)
reseed = Mock()
Expand Down