-
Notifications
You must be signed in to change notification settings - Fork 518
Pytest folder naming update #1437
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
base: main
Are you sure you want to change the base?
Conversation
…pytest - Introduced `get_pytest_case_id` and `get_pytest_baseline_name` functions in `conftest.py` to create unique identifiers for parametrized test cases and baseline files. - Updated multiple test files to utilize these functions for generating output directory names, ensuring consistency and avoiding collisions in test outputs. - Refactored test function signatures to include the `request` parameter where necessary for accessing the pytest request context.
- Introduced `_sanitize_test_id` function to handle sanitization of test identifiers for file paths. - Updated test files to utilize the new `get_pytest_case_id` function for generating baseline file names, ensuring uniformity in output directory naming. - Removed obsolete baseline files and added new ones to reflect updated test cases.
|
Thanks for the PR, the naming consistency goal is very helpful. One comment: fixtures in A possible alternative solution could be adding a fixture like: # conftest.py
@pytest.fixture
def case_id(request):
return get_pytest_case_id(request)Then use it where needed: def test_dense(case_id, backend, io_type):
...
output_dir = str(test_root_path / case_id)
... |
|
On this job failure: It looks like this specific baseline file (the Also, while digging into this I realized that the new names rely on pytest’s auto‑generated param IDs when the parameters are objects (like Keras layer instances). That’s why we get @pytest.mark.parametrize(
"activation_function",
[...],
ids=["relu", "leaky_relu", "elu", "p_re_lu", "sigmoid"],
) |
- Replaced the `get_pytest_case_id` function with a new fixture `test_case_id` to streamline the generation of unique identifiers for test cases. - Updated multiple test files to utilize the new `test_case_id` fixture, ensuring consistent output directory naming across tests. - Removed obsolete references to the old identifier function.
…learning/hls4ml into pytest-naming-update
- Updated the `garnet_models` and `garnet_stack_models` fixtures to replace the `request` parameter with `test_case_id` f
Description
This PR updates pytest test naming conventions across the hls4ml test suite, it address the issue #1436:
conftest.pyfor generating unique test case identifiers in pytesttest_activations-elu-Vitis-io_parallel.jsoninstead of older patterns)The motivation is to improve test discoverability, reduce naming conflicts, and make test output more readable when running subsets of tests.
Type of change
For a new feature or function, please create an issue first to discuss it
with us before submitting a pull request.
Note: Please delete options that are not relevant.
Tests
Test Configuration:
The modification affects the tests, no additional test is needed.
Checklist
pre-commiton the files I edited or added.