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

Refactor PontosVersionCommand #2

Merged
merged 6 commits into from
Apr 14, 2020
Merged

Refactor PontosVersionCommand #2

merged 6 commits into from
Apr 14, 2020

Conversation

bjoernricks
Copy link
Member

@bjoernricks bjoernricks commented Apr 14, 2020

Don't require to implement an own VersionCommand for the library/tool using pontos for handling version information. Instead allow to specify the version file in the pyproject.toml.

[tool.pontos.version]
version-module-file = "foo/__version__.py"

Checklist:

Drop name parameter because it is mostly unused. Require to pass
pyproject_toml_path and version_file_path to the VersionCommand
constructor.
Add a generic implementation of the get_current_version method to
VersionCommand class. It tries to import the module specified by
version_file_path and returns the __version__ variable from this module.
Don't hardcode version_file_path and pyproject_toml_path in
PontosVersionCommand. Instead try to load the pyproject.toml file and
read the version file path from a [tool.pontos.version] section.
This will allow to show, verify and update the version more easily.
@codecov
Copy link

codecov bot commented Apr 14, 2020

Codecov Report

Merging #2 into master will decrease coverage by 1.04%.
The diff coverage is 88.05%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master       #2      +/-   ##
==========================================
- Coverage   91.26%   90.22%   -1.05%     
==========================================
  Files          14       15       +1     
  Lines         378      409      +31     
==========================================
+ Hits          345      369      +24     
- Misses         33       40       +7     
Impacted Files Coverage Δ
pontos/version/version.py 68.75% <68.00%> (-3.05%) ⬇️
tests/version/__init__.py 100.00% <100.00%> (ø)
tests/version/test_pontos_version_command.py 100.00% <100.00%> (ø)
tests/version/test_print_current_version.py 100.00% <100.00%> (ø)
tests/version/test_update_pyroject_version.py 100.00% <100.00%> (ø)
tests/version/test_update_version_file.py 100.00% <100.00%> (ø)
tests/version/test_verify_version.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5c87810...09045dd. Read the comment docs.

@bjoernricks bjoernricks marked this pull request as ready for review April 14, 2020 10:41
@bjoernricks bjoernricks merged commit a71d59f into greenbone:master Apr 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant