diff --git a/.gitignore b/.gitignore index e0fbe0994d8a7c695caffb5fe3135d0cc54abc0b..3ecdfc9dd61c77ead268c28b9787b65ad31078eb 100644 --- a/.gitignore +++ b/.gitignore @@ -55,3 +55,4 @@ Thumbs.db htmlcov/ .pytest_cache /test/data/ +report.html diff --git a/test/test_data_generator.py b/test/test_data_generator.py index 3084647657a9bf7b88200f7691a45dbee5a8c3cf..4da70783bf1718c033f50969a78e03391bec6bbf 100644 --- a/test/test_data_generator.py +++ b/test/test_data_generator.py @@ -13,10 +13,11 @@ class TestDataGenerator: @pytest.fixture def gen(self): - return DataGenerator('data', 'UBA', 'DEBW107', ['o3', 'temp'], 'datetime', 'variables', 'o3') + return DataGenerator(os.path.join(os.path.dirname(__file__), 'data'), 'UBA', 'DEBW107', ['o3', 'temp'], + 'datetime', 'variables', 'o3') def test_init(self, gen): - assert gen.path == os.path.abspath('data') + assert gen.path == os.path.join(os.path.dirname(__file__), 'data') assert gen.network == 'UBA' assert gen.stations == ['DEBW107'] assert gen.variables == ['o3', 'temp'] diff --git a/test/test_data_preparation.py b/test/test_data_preparation.py index c118e0d53ea368d99e89bfe72dd0a9bd5ae01b6d..5d45c041b6e669cced56172d41fc2f9653dd30e7 100644 --- a/test/test_data_preparation.py +++ b/test/test_data_preparation.py @@ -13,8 +13,8 @@ class TestDataPrep: @pytest.fixture def data(self): - return DataPrep('test/data/', 'dummy', 'DEBW107', ['o3', 'temp'], test='testKWARGS', - statistics_per_var={'o3': 'dma8eu', 'temp': 'maximum'}) + return DataPrep(os.path.join(os.path.dirname(__file__), 'data'), 'dummy', 'DEBW107', ['o3', 'temp'], + test='testKWARGS', statistics_per_var={'o3': 'dma8eu', 'temp': 'maximum'}) def test_init(self, data): assert data.path == os.path.join(os.path.abspath(os.path.dirname(__file__)), 'data') @@ -41,13 +41,13 @@ class TestDataPrep: def test_set_file_name_and_meta(self): d = object.__new__(DataPrep) - d.path = os.path.abspath('test/data/test') + d.path = os.path.abspath('test/data/') d.station = 'TESTSTATION' d.variables = ['a', 'bc'] assert d._set_file_name() == os.path.join(os.path.abspath(os.path.dirname(__file__)), - "data/test/TESTSTATION_a_bc.nc") + "data/TESTSTATION_a_bc.nc") assert d._set_meta_file_name() == os.path.join(os.path.abspath(os.path.dirname(__file__)), - "data/test/TESTSTATION_a_bc_meta.csv") + "data/TESTSTATION_a_bc_meta.csv") @pytest.mark.parametrize('opts', [{'dim': 'datetime', 'method': 'nearest', 'limit': 10, 'use_coordinate': True}, {'dim': 'datetime', 'limit': 5}, {'dim': 'datetime'}])