Skip to content

Commit 0362413

Browse files
committed
Ignores phantom-types for python3.7
1 parent d80bac8 commit 0362413

File tree

5 files changed

+137
-72
lines changed

5 files changed

+137
-72
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ We follow Semantic Versions since the `0.1.0` release.
1515

1616
- Fixes that types referenced in multiple typeclasses
1717
were not handling `Supports` properly #249
18+
- Fixes typing bug with `ABC` and mutable typeclass signature #259
1819

1920

2021
## Version 0.3.0

docs/conftest.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import sys
2+
from pathlib import Path
3+
from types import MappingProxyType
4+
5+
from typing_extensions import Final
6+
7+
PYTHON_VERSION: Final = (sys.version_info.major, sys.version_info.minor)
8+
ENABLE_SINCE: Final = MappingProxyType({
9+
(3, 8): frozenset((
10+
Path('docs/pages/concept.rst'),
11+
)),
12+
})
13+
PATHS_TO_IGNORE_NOW: Final = frozenset(
14+
path.absolute()
15+
for since_python, to_ignore in ENABLE_SINCE.items()
16+
for path in to_ignore
17+
if PYTHON_VERSION < since_python
18+
)
19+
20+
21+
# TODO: remove after `phantom-types` release with `python3.7` support
22+
def pytest_collection_modifyitems(items) -> None: # noqa: WPS110
23+
"""Conditionally removes some collected docstests."""
24+
to_ignore_items = []
25+
for test_item in items:
26+
if not getattr(test_item, 'dtest', None):
27+
continue
28+
if Path(test_item.dtest.filename) in PATHS_TO_IGNORE_NOW:
29+
to_ignore_items.append(test_item)
30+
31+
for to_ignore in to_ignore_items:
32+
items.remove(to_ignore)

0 commit comments

Comments
 (0)