From 3dcf31a46f073e71f9a7829451a588fbde18b41a Mon Sep 17 00:00:00 2001 From: Lewis Chambers Date: Wed, 19 Jun 2024 15:48:39 +0100 Subject: [PATCH] Removed slow marks and building .db before tests --- .github/workflows/test.yml | 1 + .gitignore | 3 ++- src/tests/test_db.py | 10 ++-------- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f2d31a0..77fe3af 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -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 diff --git a/.gitignore b/.gitignore index 23ecb5d..091353a 100644 --- a/.gitignore +++ b/.gitignore @@ -12,4 +12,5 @@ aws-auth !.github/* docs/_* *.sh -**/*.csv \ No newline at end of file +**/*.csv +**/*.db \ No newline at end of file diff --git a/src/tests/test_db.py b/src/tests/test_db.py index e22b5a9..960e271 100644 --- a/src/tests/test_db.py +++ b/src/tests/test_db.py @@ -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" @@ -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) @@ -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"] @@ -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" @@ -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")) @@ -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.""" @@ -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."""