tests: convert util.pathprefix2dict tests from unittest to pytest#6433
Conversation
|
Hello 👋 |
|
Hey @aciba90 can you look at this PR and let me know if there are any changes needed. |
| self.tmp = tempfile.mkdtemp() | ||
| self.addCleanup(shutil.rmtree, self.tmp) | ||
| @pytest.fixture | ||
| def tmpdir_path(tmp_path): |
There was a problem hiding this comment.
This fixuture is unnecessary, could you please directly use tmp_path in each test?
|
Thanks for the feedback @aciba90 |
aciba90
left a comment
There was a problem hiding this comment.
Thanks! I think you didn't push you latest changes.
| from tests.unittests.helpers import populate_dir | ||
|
|
||
|
|
||
| class TestPathPrefix2Dict(TestCase): |
There was a problem hiding this comment.
Could we also keep the class grouping?
015de02 to
009f7e6
Compare
… keep class grouping
|
hey @aciba90, can you check this once and lemme know for any other changes |
|
hey @aciba90, can you check this once and lemme know for any other changes |
Summary
Added unit tests for
util.pathprefix2dict.Changes
test_required_onlyto verify required keys work correctly.test_required_missingto ensure errors are raised when required keys are missing.test_no_required_and_optionalfor empty input handling.test_required_and_optionalto validate both required and optional keys.Result
All tests pass (
pytest -v tests/unittests/test_pathprefix2dict.py).This improves test coverage for the function.