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

Test coverage #2273

Closed
sr-murthy opened this issue Sep 23, 2023 · 2 comments · Fixed by #2283
Closed

Test coverage #2273

sr-murthy opened this issue Sep 23, 2023 · 2 comments · Fixed by #2283
Labels
🚧 maintenance Test cases or other project stuff

Comments

@sr-murthy
Copy link
Contributor

sr-murthy commented Sep 23, 2023

@frostming I'm not sure this fits in as a "feature request", but you've mentioned test coverage as needing improvement in the docs. I'm a newbie, but I've set up my PDM dev. env. Would it be worth adding a test coverage script to tool.pdm.scripts, which will measure and report coverage (default to console), e.g. something like:

coverage = "pytest --cov=src/pdm --cov-branch tests/"

Currently, this produces an overall coverage of 83%. There are some modules with much lower coverage. Are there any simple ones I could start on improving test coverage? Thanks for any suggestions.

@sr-murthy sr-murthy added the ⭐ enhancement Improvements for existing features label Sep 23, 2023
@frostming frostming added 🚧 maintenance Test cases or other project stuff and removed ⭐ enhancement Improvements for existing features labels Sep 25, 2023
@sr-murthy
Copy link
Contributor Author

@frostming FYI I'm planning to submit a PR containing test cases for generic utilities and other functions which are more "Standalone", since I'm relatively new to the codebase and still trying to work my way through. I hope that's OK.

@frostming
Copy link
Collaborator

Nice, welcome to contribute

sr-murthy added a commit to sr-murthy/pdm that referenced this issue Oct 3, 2023
@frostming frostming linked a pull request Oct 9, 2023 that will close this issue
1 task
frostming added a commit that referenced this issue Oct 17, 2023
* Update project TOML to add test coverage entrypoint + add tests for `pdm.utils.create_tracked_tempdir`

* Add tests for `pdm.utils.get_trusted_hosts`

* Add tests for `pdm.utils.url_without_fragments`

* Add tests for `pdm.utils.join_list_with`

* Add a parameterised fixture for repository configs + update tests for `pdm.utils.get_trusted_hosts`

* Add tests for `pdm.utils.get_user_email_from_git`

* Add tests for `pdm.utils.add_ssh_scheme_to_git_uri`

* Add tests for `pdm.utils.path_to_url`

* Add tests for `pdm.utils.path_replace`

* Add tests for `pdm.utils.is_path_relative_to`

* Fix test name typo for `utils.expand_env_vars_in_auth`

* Add tests for `utils.get_venv_like_prefix`

* Add tests for `utils.get_rev_from_url`

* Correct test case input for `utils.add_ssh_scheme_to_uri`

* Add tests for `utils.url_to_path`

* Add tests for `utils.normalize_name`

* Add tests for `utils.is_editable`

* Add news fragment for issue #2273

* Revert changes to `pdm.utils.join_list_with`

* Amend tests for `pdm.utils.get_venv_like_prefix` to make them platform- and Python-compatible

* Amend tests for `pdm.utils.path_to_url` to make them platform-compatible

* Tweak `conftest._PathFactory.get_py_compatible_mock_path` - amend Python version check

* Tweak some `utils` tests to skip on Windows + minor refactoring of some fixtures

* Fix path fixtures in `conftest` + add Windows-only test case for `utils.url_to_path`

* Update tests/test_utils.py

fix failing `url_to_path` test cases

Co-authored-by: Frost Ming <mianghong@gmail.com>

* Update tests/test_utils.py

tweak `utils.url_to_path`test case skipping

Co-authored-by: Frost Ming <mianghong@gmail.com>

* Apply suggestions from code review

---------

Co-authored-by: Frost Ming <mianghong@gmail.com>
frostming added a commit that referenced this issue Oct 17, 2023
* Update project TOML to add test coverage entrypoint + add tests for `pdm.utils.create_tracked_tempdir`

* Add tests for `pdm.utils.get_trusted_hosts`

* Add tests for `pdm.utils.url_without_fragments`

* Add tests for `pdm.utils.join_list_with`

* Add a parameterised fixture for repository configs + update tests for `pdm.utils.get_trusted_hosts`

* Add tests for `pdm.utils.get_user_email_from_git`

* Add tests for `pdm.utils.add_ssh_scheme_to_git_uri`

* Add tests for `pdm.utils.path_to_url`

* Add tests for `pdm.utils.path_replace`

* Add tests for `pdm.utils.is_path_relative_to`

* Fix test name typo for `utils.expand_env_vars_in_auth`

* Add tests for `utils.get_venv_like_prefix`

* Add tests for `utils.get_rev_from_url`

* Correct test case input for `utils.add_ssh_scheme_to_uri`

* Add tests for `utils.url_to_path`

* Add tests for `utils.normalize_name`

* Add tests for `utils.is_editable`

* Add news fragment for issue #2273

* Revert changes to `pdm.utils.join_list_with`

* Amend tests for `pdm.utils.get_venv_like_prefix` to make them platform- and Python-compatible

* Amend tests for `pdm.utils.path_to_url` to make them platform-compatible

* Tweak `conftest._PathFactory.get_py_compatible_mock_path` - amend Python version check

* Tweak some `utils` tests to skip on Windows + minor refactoring of some fixtures

* Fix path fixtures in `conftest` + add Windows-only test case for `utils.url_to_path`

* Update tests/test_utils.py

fix failing `url_to_path` test cases

Co-authored-by: Frost Ming <mianghong@gmail.com>

* Update tests/test_utils.py

tweak `utils.url_to_path`test case skipping

Co-authored-by: Frost Ming <mianghong@gmail.com>

* Apply suggestions from code review

---------

Co-authored-by: Frost Ming <mianghong@gmail.com>
Signed-off-by: Frost Ming <me@frostming.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🚧 maintenance Test cases or other project stuff
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants