Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add unit tests for gpm_api.io #8

Merged
merged 39 commits into from
Sep 6, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
e6bb56e
Unit tests for gpm_api.io.checks, run coverage on pytest
evanjt Jul 19, 2023
5b642a6
Use black, remove bbox check, move bbox test to geospatial test for f…
evanjt Jul 20, 2023
1e79137
Cast np datetime [ns] to [us]
evanjt Jul 20, 2023
8670b55
Add io/directories tests, modify replace() in curl path constructor a…
evanjt Jul 24, 2023
fb0d33a
Mock ftplib, add tests to disk, download, info
evanjt Jul 24, 2023
3542f84
Modify checks to use os.path.sep to cater for Windows paths
evanjt Jul 24, 2023
e60baec
Add type hint exception for Python 3.8
evanjt Jul 24, 2023
4a7e561
Apply sed command to conftest.py for 3.8 type hints
evanjt Jul 24, 2023
c36f2fe
Modify type hints to be compatible with Python 3.8
evanjt Jul 25, 2023
9bac278
Remove type annotation hack for python 3.8
evanjt Jul 25, 2023
4cdf6f3
test _download_files
evanjt Aug 9, 2023
0700e40
Add test for file completeness
evanjt Aug 9, 2023
d5271d1
Add filter tests
evanjt Aug 10, 2023
45686b5
Add filter unit tests
evanjt Aug 10, 2023
827ff64
Merge branch 'ghiggi:main' into add_io_tests
evanjt Aug 11, 2023
6e4eda0
Merge branch 'add_io_tests' of github.com:EPFL-ENAC/gpm_api into add_…
evanjt Aug 11, 2023
db103ff
Update tests to reflect branch changes
evanjt Aug 11, 2023
23b660a
Add io tests: download_files, convert_pps_to_disk_filepaths, flatten_…
evanjt Aug 11, 2023
97997aa
Add pps tests
evanjt Aug 11, 2023
b0be78a
Add data integrity tests and static filepath fixtures
evanjt Aug 16, 2023
1f2b2af
Mock the user configuration function as to user in-memory configurati…
evanjt Aug 16, 2023
86e4aee
Disable check_start_end_time on empty end_time due to testing inconsi…
evanjt Aug 16, 2023
1b75aae
Remove system specific paths
evanjt Aug 16, 2023
a4e3552
Modify path to os library
evanjt Aug 16, 2023
eca5f20
Fix windows paths
evanjt Aug 16, 2023
49b55c7
Replace : character to - for windows path compatibility
evanjt Aug 16, 2023
2549c72
Merge branch 'ghiggi:main' into add_io_tests
evanjt Aug 18, 2023
54c1e81
Add tests to validate future date errors if using None end_time in fi…
evanjt Aug 21, 2023
c0358e5
Update comment, removing TODO
evanjt Aug 21, 2023
21375e7
Update docstring explaining defaults in filter_by_time
evanjt Aug 21, 2023
8827b5e
Remove redundant auth fixtures from conftest, replace with values in …
evanjt Aug 31, 2023
106d18e
Replace ns with seconds
evanjt Aug 31, 2023
36dacd2
Update gpm_api/tests/io/test_download.py
ghiggi Sep 5, 2023
3921c02
Revert to seconds
evanjt Sep 5, 2023
733b76d
Check timezone, throw error if given and is not UTC
evanjt Sep 5, 2023
8cb2d96
When timezone given and UTC, strip tz information. Test case of using…
evanjt Sep 6, 2023
a23b9e1
Add more flatten list cases, add condition to download.flatten_list()…
evanjt Sep 6, 2023
732b8ed
Replace props with info_dict
evanjt Sep 6, 2023
03d7578
Update gpm_api/tests/io/test_checks.py
ghiggi Sep 6, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file added gpm_api/tests/__init__.py
Empty file.
46 changes: 46 additions & 0 deletions gpm_api/tests/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import pytest
from gpm_api.io.products import get_info_dict, available_products


@pytest.fixture
def product_types() -> list[str]:
''' Return a list of all product types from the info dict'''
product_types = []
for product, props in get_info_dict().items():
product_types += props['product_types']

product_types = list(set(product_types)) # Dedup list

return product_types


@pytest.fixture
def product_categories() -> list[str]:
''' Return a list of product categories from the info dict'''

return list(
set([props['product_category'] for props in get_info_dict().values()])
)


@pytest.fixture
def product_levels() -> list[str]:
''' Return a list of product levels from the info dict'''

# Available in gpm_api.io.checks.check_product_level()
return ['1A', '1B', '1C', '2A', '2B']


@pytest.fixture
def versions() -> list[int]:
''' Return a list of versions '''

# Available in gpm_api.io.checks.check_version()
return [4, 5, 6, 7]
ghiggi marked this conversation as resolved.
Show resolved Hide resolved


@pytest.fixture
def products() -> list[str]:
''' Return a list of all products regardless of type '''

return available_products()
Loading