diff options
author | Max <msuraev@sysmocom.de> | 2018-01-14 18:27:31 +0100 |
---|---|---|
committer | Max <msuraev@sysmocom.de> | 2018-01-14 18:33:26 +0100 |
commit | cd5a6e419e945a1cd9b56f5df705d383a3b69b4c (patch) | |
tree | d239c14c9860cb1435f91fdae928ab58bb90b38b | |
parent | 34d2ca5bc8ccb61bb263c05d16fe7bf53a27dae2 (diff) |
Fix absolute import issue in py3
As of 577f2a95e4f01c58a0a4f4ccb3b70d9c048b626e in osmo-ci, the
contrib/jenkins.sh isused forinstallation. This causes the issue with
python3 because test coded use absolute import by default.
Fix this by adding relative path and import from ../osmopy to make
sure test code uses the current module and not the one which might be
already installed in the system.
Change-Id: I8ac3c0d45fb2e1d18646048703ac405be1c7e539
-rw-r--r-- | osmopy/__init__.py | 2 | ||||
-rw-r--r-- | tests/test_py3.py | 7 |
2 files changed, 7 insertions, 2 deletions
diff --git a/osmopy/__init__.py b/osmopy/__init__.py index d3d3005..c3d4b8c 100644 --- a/osmopy/__init__.py +++ b/osmopy/__init__.py @@ -1,4 +1,4 @@ #!/usr/bin/env python -__version__ = '0.0.7' +__version__ = '0.0.8' __all__ = ['obscvty', 'osmoutil', 'osmo_ipa', 'osmo_interact'] diff --git a/tests/test_py3.py b/tests/test_py3.py index 3a96d9f..909d057 100644 --- a/tests/test_py3.py +++ b/tests/test_py3.py @@ -2,7 +2,12 @@ # just a smoke test for osmopy -import asyncio, random +import asyncio, random, sys, os + +# we have to use this ugly hack to workaroundbrokenrelative imports in py3: +# from ..osmopy.osmo_ipa import Ctrl +# does not work as expected +sys.path.append(os.path.dirname(os.path.dirname(os.path.realpath(__file__)))) from osmopy.osmo_ipa import Ctrl from osmopy import __version__ |