aboutsummaryrefslogtreecommitdiff
path: root/tests/unit/db/test_db.py
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2022-02-14 06:56:32 +0300
committerFrederick Muriuki Muriithi2022-02-17 06:37:30 +0300
commit74044f3c7985308b4996da3a52f91c5c20a19194 (patch)
treed86714b859b31cbbd1755522f8abd8eed16e321b /tests/unit/db/test_db.py
parent67f517aa0f44f55dc691ffd791bf22ef7af0b02c (diff)
downloadgenenetwork3-74044f3c7985308b4996da3a52f91c5c20a19194.tar.gz
Use pytest's "mark" feature to categorise tests
Use pytest's `mark` feature to explicitly categorise the tests and run them per category
Diffstat (limited to 'tests/unit/db/test_db.py')
-rw-r--r--tests/unit/db/test_db.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/unit/db/test_db.py b/tests/unit/db/test_db.py
index e47c9fd..8ac468c 100644
--- a/tests/unit/db/test_db.py
+++ b/tests/unit/db/test_db.py
@@ -2,6 +2,8 @@
from unittest import TestCase
from unittest import mock
+import pytest
+
from gn3.db import fetchall
from gn3.db import fetchone
from gn3.db import update
@@ -14,6 +16,7 @@ from gn3.db.metadata_audit import MetadataAudit
class TestCrudMethods(TestCase):
"""Test cases for CRUD methods"""
+ @pytest.mark.unit_test
def test_update_phenotype_with_no_data(self):
"""Test that a phenotype is updated correctly if an empty Phenotype dataclass
is provided
@@ -24,6 +27,7 @@ class TestCrudMethods(TestCase):
conn=db_mock, table="Phenotype",
data=Phenotype(), where=Phenotype()), None)
+ @pytest.mark.unit_test
def test_update_phenotype_with_data(self):
"""
Test that a phenotype is updated correctly if some
@@ -46,6 +50,7 @@ class TestCrudMethods(TestCase):
"Submitter = %s WHERE id = %s AND Owner = %s",
('Test Pre Pub', 'Test Post Pub', 'Rob', 1, 'Rob'))
+ @pytest.mark.unit_test
def test_fetch_phenotype(self):
"""Test that a single phenotype is fetched properly
@@ -68,6 +73,7 @@ class TestCrudMethods(TestCase):
"SELECT * FROM Phenotype WHERE id = %s AND Owner = %s",
(35, 'Rob'))
+ @pytest.mark.unit_test
def test_fetchall_metadataaudit(self):
"""Test that multiple metadata_audit entries are fetched properly
@@ -96,6 +102,7 @@ class TestCrudMethods(TestCase):
"dataset_id = %s AND editor = %s"),
(35, 'Rob'))
+ @pytest.mark.unit_test
# pylint: disable=R0201
def test_probeset_called_with_right_columns(self):
"""Given a columns argument, test that the correct sql query is
@@ -112,6 +119,7 @@ class TestCrudMethods(TestCase):
"Name = %s",
("1446112_at",))
+ @pytest.mark.unit_test
def test_diff_from_dict(self):
"""Test that a correct diff is generated"""
self.assertEqual(diff_from_dict({"id": 1, "data": "a"},