Skip to content

Commit cd17118

Browse files
Updated paths in tests for data files
1 parent 45a8726 commit cd17118

File tree

5 files changed

+11
-11
lines changed

5 files changed

+11
-11
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
pip install .[test]
2727
- name: Build test DB
2828
run: |
29-
python src/tests/data/build_database.py
29+
python tests/data/build_database.py
3030
- name: Lint with flake8
3131
run: |
3232
# stop the build if there are Python syntax errors or undefined names

tests/test_db.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
import sqlite3
1717

1818
CONFIG_PATH = Path(
19-
Path(__file__).parents[1], "iotswarm", "__assets__", "config.cfg"
19+
Path(__file__).parents[1], "src", "iotswarm", "__assets__", "config.cfg"
2020
)
2121
config_exists = pytest.mark.skipif(
2222
not CONFIG_PATH.exists(),
@@ -210,7 +210,7 @@ async def test__repr__(self):
210210
oracle2.__repr__(), expected2
211211
)
212212

213-
CSV_PATH = Path(Path(__file__).parents[1], "iotswarm", "__assets__", "data")
213+
CSV_PATH = Path(Path(__file__).parents[1], "src", "iotswarm", "__assets__", "data")
214214
CSV_DATA_FILES = [Path(x) for x in glob(str(Path(CSV_PATH, "*.csv")))]
215215
sqlite_db_exist = pytest.mark.skipif(not Path(CSV_PATH, "cosmos.db").exists(), reason="Local cosmos.db does not exist.")
216216

@@ -346,7 +346,7 @@ class TestSqliteDB(unittest.TestCase):
346346

347347
@sqlite_db_exist
348348
def setUp(self):
349-
self.db_path = Path(Path(__file__).parents[1], "iotswarm", "__assets__", "data", "cosmos.db")
349+
self.db_path = Path(Path(__file__).parents[1], "src", "iotswarm", "__assets__", "data", "cosmos.db")
350350
self.table = CosmosTable.LEVEL_1_SOILMET_30MIN
351351

352352
if self.db_path.exists():
@@ -387,7 +387,7 @@ class TestSQLiteDBIndexing(unittest.TestCase):
387387

388388
@classmethod
389389
def setUpClass(cls):
390-
cls.db_path = Path(Path(__file__).parents[1], "iotswarm", "__assets__", "data", "cosmos.db")
390+
cls.db_path = Path(Path(__file__).parents[1], "src", "iotswarm", "__assets__", "data", "cosmos.db")
391391
cls.table = CosmosTable.LEVEL_1_SOILMET_30MIN
392392
cls.site_id = "MORLY"
393393

@@ -439,7 +439,7 @@ class TestLoopingSQLite3DBEndToEnd(unittest.IsolatedAsyncioTestCase):
439439

440440
@sqlite_db_exist
441441
def setUp(self):
442-
self.db_path = Path(Path(__file__).parents[1], "iotswarm", "__assets__", "data", "cosmos.db")
442+
self.db_path = Path(Path(__file__).parents[1], "src", "iotswarm", "__assets__", "data", "cosmos.db")
443443
if self.db_path.exists():
444444
self.database = db.LoopingSQLite3(self.db_path)
445445
self.maxDiff = None

tests/test_devices.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@
1616
from datetime import datetime, timedelta
1717

1818
CONFIG_PATH = Path(
19-
Path(__file__).parents[1], "iotswarm", "__assets__", "config.cfg"
19+
Path(__file__).parents[1], "src", "iotswarm", "__assets__", "config.cfg"
2020
)
2121
config_exists = pytest.mark.skipif(
2222
not CONFIG_PATH.exists(),
2323
reason="Config file `config.cfg` not found in root directory.",
2424
)
2525

26-
DATA_DIR = Path(Path(__file__).parents[1], "iotswarm", "__assets__", "data")
26+
DATA_DIR = Path(Path(__file__).parents[1], "src", "iotswarm", "__assets__", "data")
2727
sqlite_db_exist = pytest.mark.skipif(not Path(DATA_DIR, "cosmos.db").exists(), reason="Local cosmos.db does not exist.")
2828

2929

@@ -335,7 +335,7 @@ async def test__get_payload(self):
335335
class TestBaseDevicesSQLite3Used(unittest.IsolatedAsyncioTestCase):
336336

337337
def setUp(self):
338-
db_path = Path(Path(__file__).parents[1], "iotswarm","__assets__", "data", "cosmos.db")
338+
db_path = Path(Path(__file__).parents[1], "src", "iotswarm","__assets__", "data", "cosmos.db")
339339
if db_path.exists():
340340
self.db = LoopingSQLite3(db_path)
341341
self.table = CosmosTable.LEVEL_1_SOILMET_30MIN

tests/test_messaging.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
import logging
1313

1414

15-
ASSETS_PATH = Path(Path(__file__).parents[1], "iotswarm", "__assets__")
15+
ASSETS_PATH = Path(Path(__file__).parents[1], "src", "iotswarm", "__assets__")
1616
CONFIG_PATH = Path(ASSETS_PATH, "config.cfg")
1717

1818
config_exists = pytest.mark.skipif(

tests/test_swarm.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from pathlib import Path
1313

1414
SQL_PATH = Path(
15-
Path(__file__).parents[1], "iotswarm", "__assets__", "data", "cosmos.db"
15+
Path(__file__).parents[1], "src", "iotswarm", "__assets__", "data", "cosmos.db"
1616
)
1717
sqlite_db_exist = pytest.mark.skipif(
1818
not SQL_PATH.exists(), reason="Local cosmos.db does not exist."

0 commit comments

Comments
 (0)