-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
changing the names for better consistency
- Loading branch information
1 parent
b4d0c70
commit 08d3cd5
Showing
20 changed files
with
884 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
from .utils import ( | ||
random_csv_file, | ||
random_tsv_file, | ||
random_ndjson_file, | ||
random_invalid_datetime_rows, | ||
random_invalid_datetime_and_value_rows, | ||
random_invalid_value_rows, | ||
random_valid_format_rows, | ||
) | ||
import pytest | ||
from pytest import TempdirFactory | ||
from pathlib import Path | ||
from src.adapters.file_parse_iot_records.csv import CSVParseIOTRecordsClient | ||
from src.deployments.script.config import CSVParserConfig | ||
|
||
|
||
@pytest.fixture(scope="session") | ||
def setup_tempdir(tmpdir_factory: TempdirFactory) -> Path: | ||
return Path(tmpdir_factory.mktemp("artifact")) | ||
|
||
|
||
@pytest.fixture(scope="function") | ||
def random_valid_csv_file(setup_tempdir: Path) -> Path: | ||
return random_csv_file(setup_tempdir, random_valid_format_rows()) | ||
|
||
|
||
@pytest.fixture(scope="function") | ||
def random_invalid_datetime_and_value_csv_file(setup_tempdir: Path) -> Path: | ||
return random_csv_file(setup_tempdir, random_invalid_datetime_and_value_rows()) | ||
|
||
|
||
@pytest.fixture(scope="function") | ||
def random_invalid_datetime_csv_file(setup_tempdir: Path) -> Path: | ||
return random_csv_file(setup_tempdir, random_invalid_datetime_rows()) | ||
|
||
|
||
@pytest.fixture(scope="function") | ||
def random_invalid_value_csv_file(setup_tempdir: Path) -> Path: | ||
return random_csv_file(setup_tempdir, random_invalid_value_rows()) | ||
|
||
|
||
@pytest.fixture(scope="function") | ||
def random_valid_tsv_file(setup_tempdir: Path) -> Path: | ||
return random_tsv_file(setup_tempdir, random_valid_format_rows()) | ||
|
||
|
||
@pytest.fixture(scope="function") | ||
def random_invalid_datetime_and_value_tsv_file(setup_tempdir: Path) -> Path: | ||
return random_tsv_file(setup_tempdir, random_invalid_datetime_and_value_rows()) | ||
|
||
|
||
@pytest.fixture(scope="function") | ||
def random_invalid_datetime_tsv_file(setup_tempdir: Path) -> Path: | ||
return random_tsv_file(setup_tempdir, random_invalid_datetime_rows()) | ||
|
||
|
||
@pytest.fixture(scope="function") | ||
def random_invalid_value_tsv_file(setup_tempdir: Path) -> Path: | ||
return random_tsv_file(setup_tempdir, random_invalid_value_rows()) | ||
|
||
|
||
@pytest.fixture(scope="function") | ||
def random_valid_ndjson_file(setup_tempdir: Path) -> Path: | ||
return random_ndjson_file(setup_tempdir, random_valid_format_rows()) | ||
|
||
|
||
@pytest.fixture(scope="function") | ||
def random_invalid_datetime_and_value_ndjson_file(setup_tempdir: Path) -> Path: | ||
return random_ndjson_file(setup_tempdir, random_invalid_datetime_and_value_rows()) | ||
|
||
|
||
@pytest.fixture(scope="function") | ||
def random_invalid_datetime_ndjson_file(setup_tempdir: Path) -> Path: | ||
return random_ndjson_file(setup_tempdir, random_invalid_datetime_rows()) | ||
|
||
|
||
@pytest.fixture(scope="function") | ||
def random_invalid_value_ndjson_file(setup_tempdir: Path) -> Path: | ||
return random_ndjson_file(setup_tempdir, random_invalid_value_rows()) | ||
|
||
|
||
@pytest.fixture(scope="function") | ||
def csv_parse_iot_records_client() -> CSVParseIOTRecordsClient: | ||
return CSVParseIOTRecordsClient( | ||
recognized_datetime_formats=CSVParserConfig.RECOGNIZED_DATETIME_FORMATS, | ||
delimiter=CSVParserConfig.DELIMITER, | ||
) |
26 changes: 26 additions & 0 deletions
26
consumer/tests/test_adapters/test_file_parse_iot_records/test_csv/test_close.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import pytest | ||
from src.adapters.file_parse_iot_records.csv import CSVParseIOTRecordsClient | ||
from pytest import FixtureRequest | ||
|
||
|
||
@pytest.mark.smoke | ||
@pytest.mark.parametrize( | ||
"fixture_name", | ||
[ | ||
"random_valid_csv_file", | ||
"random_invalid_datetime_and_value_csv_file", | ||
"random_invalid_datetime_csv_file", | ||
"random_invalid_value_csv_file", | ||
] | ||
* 5, | ||
) | ||
def test_close_always_successful( | ||
csv_parse_iot_records_client: CSVParseIOTRecordsClient, | ||
fixture_name: str, | ||
request: FixtureRequest, | ||
): | ||
random_valid_csv_file: str = request.getfixturevalue(fixture_name) | ||
|
||
csv_parse_iot_records_client.parse(random_valid_csv_file) | ||
|
||
assert csv_parse_iot_records_client.close() |
Oops, something went wrong.