Skip to content

Commit bc786e4

Browse files
authored
Add pytest coverage for length, between, uuid, MAC, IBAN, cron, encodings and card brands (220 tests)
Add logic to make the 'validators' package importable from various locations.
1 parent 22786cc commit bc786e4

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

‎tests/conftest.py‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
"""Make the ``validators`` package importable without an install.
2+
3+
Tries, in order: the src-layout of a checked-out repo (``../src``),
4+
this workdir's ``../validators-src/src`` clone, and the repo root itself.
5+
Only directories that actually contain the ``validators`` package are added.
6+
"""
7+
8+
import os
9+
import sys
10+
11+
_HERE = os.path.dirname(os.path.abspath(__file__))
12+
_CANDIDATES = (
13+
os.path.join(_HERE, "..", "src"),
14+
os.path.join(_HERE, "..", "validators-src", "src"),
15+
os.path.join(_HERE, ".."),
16+
)
17+
for _candidate in _CANDIDATES:
18+
if os.path.isdir(os.path.join(_candidate, "validators")):
19+
sys.path.insert(0, os.path.normpath(_candidate))

0 commit comments

Comments
 (0)