Skip to content

Commit 12804a1

Browse files
committed
use latest xdist
add a workaround for pytest-dev/pytest-xdist#414
1 parent 8267bd2 commit 12804a1

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

obal/__init__.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
from functools import total_ordering
1818

1919
import yaml
20-
from pkg_resources import resource_filename
20+
import pkg_resources
2121

2222
try:
2323
import argcomplete
@@ -181,7 +181,16 @@ def data_path():
181181
"""
182182
Return the data path. Houses playbooks and configs.
183183
"""
184-
return os.environ.get('OBAL_DATA', resource_filename(__name__, 'data'))
184+
path = os.environ.get('OBAL_DATA')
185+
if path is None:
186+
path = pkg_resources.resource_filename(__name__, 'data')
187+
if not os.path.isabs(path):
188+
# this is essentially a workaround for
189+
# https://github.com/pytest-dev/pytest-xdist/issues/414
190+
distribution = pkg_resources.get_distribution('obal')
191+
path = os.path.join(distribution.location, path)
192+
193+
return path
185194

186195
@staticmethod
187196
def inventory_path():

tox.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ deps =
1414
pytest-cov
1515
pytest-flakes
1616
pytest-pylint
17-
pytest-xdist < 1.26.0
17+
pytest-xdist
1818
coveralls
1919
commands =
2020
check-manifest --ignore tox.ini,.ansible-lint,tests*,docs*,*/**/*.pyc,*/**/__pycache__

0 commit comments

Comments
 (0)