Skip to content

Commit

Permalink
Removed slow marks and building .db before tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lewis-chambers committed Jun 19, 2024
1 parent 77c9cc4 commit 3dcf31a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ jobs:
python -m pip install --upgrade pip
pip install flake8
pip install .[test]
python src/tests/data/build_database.py
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ aws-auth
!.github/*
docs/_*
*.sh
**/*.csv
**/*.csv
**/*.db
10 changes: 2 additions & 8 deletions src/tests/test_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -386,11 +386,11 @@ def setUp(self):
self.database = db.LoopingSQLite3(self.db_path)
self.maxDiff = None

@pytest.mark.slow

def test_instantiation(self):
self.assertIsInstance(self.database, db.LoopingSQLite3)
self.assertIsInstance(self.database.connection, sqlite3.Connection)
@pytest.mark.slow

def test_latest_data(self):

site_id = "MORLY"
Expand All @@ -399,7 +399,6 @@ def test_latest_data(self):

self.assertIsInstance(data, dict)

@pytest.mark.slow
def test_site_id_query(self):

sites = self.database.query_site_ids(self.table)
Expand All @@ -411,7 +410,6 @@ def test_site_id_query(self):
for site in sites:
self.assertIsInstance(site, str)

@pytest.mark.slow
def test_multiple_sites_added_to_cache(self):
sites = ["ALIC1", "MORLY", "HOLLN","EUSTN"]

Expand All @@ -422,7 +420,6 @@ def test_multiple_sites_added_to_cache(self):
self.assertIn(site, self.database.cache)
self.assertEqual(self.database.cache[site], 0)

@pytest.mark.slow
def test_cache_incremented_on_each_request(self):
site = "MORLY"

Expand All @@ -437,7 +434,6 @@ def test_cache_incremented_on_each_request(self):

last_data = data

@pytest.mark.slow
def test_cache_counter_restarts_at_end(self):
database = db.LoopingSQLite3(Path(Path(__file__).parent, "data", "database.db"))

Expand All @@ -463,7 +459,6 @@ def setUp(self):
self.maxDiff = None
self.table = CosmosTable.LEVEL_1_PRECIP_1MIN

@pytest.mark.slow
async def test_flow_with_device_attached(self):
"""Tests that data is looped through with a device making requests."""

Expand All @@ -473,7 +468,6 @@ async def test_flow_with_device_attached(self):

self.assertDictEqual(self.database.cache, {"ALIC1": 4})

@pytest.mark.slow
async def test_flow_with_swarm_attached(self):
"""Tests that the database is looped through correctly with multiple sites in a swarm."""

Expand Down

0 comments on commit 3dcf31a

Please sign in to comment.