From 74044f3c7985308b4996da3a52f91c5c20a19194 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Mon, 14 Feb 2022 06:56:32 +0300 Subject: Use pytest's "mark" feature to categorise tests Use pytest's `mark` feature to explicitly categorise the tests and run them per category --- tests/unit/db/test_datasets.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'tests/unit/db/test_datasets.py') diff --git a/tests/unit/db/test_datasets.py b/tests/unit/db/test_datasets.py index 0b8c2fe..5b86db9 100644 --- a/tests/unit/db/test_datasets.py +++ b/tests/unit/db/test_datasets.py @@ -1,6 +1,7 @@ """Tests for gn3/db/datasets.py""" from unittest import mock, TestCase +import pytest from gn3.db.datasets import ( retrieve_dataset_name, retrieve_group_fields, @@ -11,6 +12,7 @@ from gn3.db.datasets import ( class TestDatasetsDBFunctions(TestCase): """Test cases for datasets functions.""" + @pytest.mark.unit_test def test_retrieve_dataset_name(self): """Test that the function is called correctly.""" for trait_type, thresh, trait_name, dataset_name, columns, table, expected in [ @@ -42,6 +44,7 @@ class TestDatasetsDBFunctions(TestCase): table=table, cols=columns), {"threshold": thresh, "name": dataset_name}) + @pytest.mark.unit_test def test_retrieve_probeset_group_fields(self): """ Test that the `group` and `group_id` fields are retrieved appropriately @@ -65,6 +68,7 @@ class TestDatasetsDBFunctions(TestCase): " AND ProbeSetFreeze.Name = %(name)s"), {"name": trait_name}) + @pytest.mark.unit_test def test_retrieve_group_fields(self): """ Test that the group fields are set up correctly for the different trait @@ -90,6 +94,7 @@ class TestDatasetsDBFunctions(TestCase): trait_type, trait_name, dataset_info, db_mock), expected) + @pytest.mark.unit_test def test_retrieve_publish_group_fields(self): """ Test that the `group` and `group_id` fields are retrieved appropriately @@ -112,6 +117,7 @@ class TestDatasetsDBFunctions(TestCase): " AND PublishFreeze.Name = %(name)s"), {"name": trait_name}) + @pytest.mark.unit_test def test_retrieve_geno_group_fields(self): """ Test that the `group` and `group_id` fields are retrieved appropriately -- cgit v1.2.3