Skip to content

Commit dd4c693

Browse files
committed
use inspect to specify file relative to executing test
1 parent 24ea737 commit dd4c693

File tree

1 file changed

+7
-5
lines changed
  • solarforecastarbiter/io/reference_observations/tests

1 file changed

+7
-5
lines changed

solarforecastarbiter/io/reference_observations/tests/conftest.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import copy
2+
import inspect
23
import json
3-
from pkg_resources import resource_filename, Requirement
4+
import os
45

56

67
import numpy as np
@@ -11,6 +12,10 @@
1112
from solarforecastarbiter.datamodel import Site, Observation
1213

1314

15+
TEST_DATA_DIR = os.path.dirname(
16+
os.path.abspath(inspect.getfile(inspect.currentframe())))
17+
18+
1419
def site_dicts():
1520
return [copy.deepcopy(site) for site in [
1621
{
@@ -157,7 +162,4 @@ def mock_fetch(mocker, fake_ghi_data):
157162

158163
@pytest.fixture
159164
def test_json_site_file():
160-
return resource_filename(
161-
Requirement.parse('solarforecastarbiter'),
162-
'solarforecastarbiter/io/reference_observations/'
163-
'tests/data/test_site.json')
165+
return os.path.join(TEST_DATA_DIR, 'data', 'test_site.json')

0 commit comments

Comments
 (0)