Skip to content

Commit

Permalink
when running testr, avoid emitting this warning
Browse files Browse the repository at this point in the history
  • Loading branch information
javierggt committed Apr 18, 2020
1 parent 23d80a5 commit abbc090
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions ska_helpers/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,12 @@ def get_version(package, distribution=None):
# import but generate a lot of output indicating the problem.
import warnings
import traceback
warnings.warn(traceback.format_exc() + '\n\n')
warnings.warn('Failed to find a package version, setting to 0.0.0')
if 'TESTR_FILE' not in os.environ:
# this avoids a test failure when checking log files with this warning.
# Pytest will import packages such as Ska.Shell first as Shell and then as Ska.Shell.
# https://docs.pytest.org/en/latest/pythonpath.html
warnings.warn(traceback.format_exc() + '\n\n')
warnings.warn('Failed to find a package version, setting to 0.0.0')
version = '0.0.0'

return version
Expand Down

0 comments on commit abbc090

Please sign in to comment.