Skip to content

Commit a3e2953

Browse files
committed
update test file dir management - drop pkg_resources & importlib
1 parent a3f9d87 commit a3e2953

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

fooof/tests/settings.py

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,14 @@
11
"""Settings for testing fooof."""
22

33
import os
4-
5-
# Use importlib to get package related paths, importing depending on Python version
6-
# Note: can drop if/else when support goes to >= 3.9 (see: https://stackoverflow.com/a/75503824)
7-
import sys
8-
if sys.version_info >= (3, 9):
9-
import importlib.resources as importlib_resources
10-
else:
11-
import importlib_resources
4+
from pathlib import Path
125

136
###################################################################################################
147
###################################################################################################
158

169
# Path Settings
17-
BASE_TEST_FILE_PATH = importlib_resources.files(__name__.split('.')[0]) / 'tests/test_files'
18-
TEST_DATA_PATH = os.path.join(BASE_TEST_FILE_PATH, 'data')
19-
TEST_REPORTS_PATH = os.path.join(BASE_TEST_FILE_PATH, 'reports')
20-
TEST_PLOTS_PATH = os.path.join(BASE_TEST_FILE_PATH, 'plots')
10+
TESTS_PATH = Path(os.path.abspath(os.path.dirname(__file__)))
11+
BASE_TEST_FILE_PATH = TESTS_PATH / 'test_files'
12+
TEST_DATA_PATH = BASE_TEST_FILE_PATH / 'data'
13+
TEST_REPORTS_PATH = BASE_TEST_FILE_PATH / 'reports'
14+
TEST_PLOTS_PATH = BASE_TEST_FILE_PATH / 'plots'

0 commit comments

Comments
 (0)