From dd7902cf7fbdb5f34b0b7dd6c406f95754b4907a Mon Sep 17 00:00:00 2001 From: Maximilian Hils Date: Thu, 4 Jan 2018 14:22:14 +0100 Subject: [PATCH] fix #2470 --- mitmproxy/version.py | 2 +- test/mitmproxy/test_version.py | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/mitmproxy/version.py b/mitmproxy/version.py index 44ec32d4c..20a303e84 100644 --- a/mitmproxy/version.py +++ b/mitmproxy/version.py @@ -60,5 +60,5 @@ def get_version(dev: bool = False, build: bool = False, refresh: bool = False) - return mitmproxy_version -if __name__ == "__main__": +if __name__ == "__main__": # pragma: no cover print(VERSION) diff --git a/test/mitmproxy/test_version.py b/test/mitmproxy/test_version.py index 6e36ffd89..b5b33ba12 100644 --- a/test/mitmproxy/test_version.py +++ b/test/mitmproxy/test_version.py @@ -1,3 +1,4 @@ +import pathlib import runpy import subprocess from unittest import mock @@ -6,7 +7,9 @@ from mitmproxy import version def test_version(capsys): - runpy.run_module('mitmproxy.version', run_name='__main__') + here = pathlib.Path(__file__).absolute().parent + version_file = here / ".." / ".." / "mitmproxy" / "version.py" + runpy.run_path(str(version_file), run_name='__main__') stdout, stderr = capsys.readouterr() assert len(stdout) > 0 assert stdout.strip() == version.VERSION