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

Testsuite fails if run independently outside of a virtualenv #164

Open
knobix opened this issue Sep 18, 2019 · 6 comments · May be fixed by #253
Open

Testsuite fails if run independently outside of a virtualenv #164

knobix opened this issue Sep 18, 2019 · 6 comments · May be fixed by #253

Comments

@knobix
Copy link

knobix commented Sep 18, 2019

If the testsuite is executed in a native build environment (= not in a virtualenv via tox) by issuing pytest it fails with:

ImportError while loading conftest '/wrkdirs/usr/ports/devel/py-oci/work-py36/oci-python-sdk-2.3.1/tests/conftest.py'.
tests/conftest.py:8: in <module>
    from tests.integ import util
tests/integ/util.py:12: in <module>
    from .. import test_config_container
tests/test_config_container.py:8: in <module>
    from . import vcr_mods  # noqa: F401
E   ImportError: cannot import name 'vcr_mods'

The testsuite will pass when the vcr_mods subdirectory from https://github.com/oracle/oci-cli/tree/master/tests/vcr_mods is copied to tests/:

=========== short test summary info ==========
SKIPPED [14] /wrkdirs/usr/ports/devel/py-oci/work-py36/oci-python-sdk-2.3.1/tests/conftest.py:41: Config file, /wrkdirs/usr/ports/devel/py-oci/work-py36/oci-python-sdk-2.3.1/tests/resources/config, does not exist
===== 20 passed, 14 skipped in 4.23 seconds =====

As far I can see only the following additional requirements are needed to get a successful run of the testsuite, so they could be added e.g. as tests_requires to setup.py:

  • pytest
  • requests
  • vcrpy

It would be also nice to package the tests/ directory for the sdist so it would be available also via PyPI.

Environment:

  • OS: FreeBSD 11.2-, 11.3-, 12.0-RELEASE
  • Python Version: 2.7.16, 3.6.9
@arthall arthall added SDK Issue pertains to the SDK itself and not specific to any service enhancement labels Sep 18, 2019
@jasonyin
Copy link
Contributor

Hi @knobix , thanks for reporting the issue. Running SDK in virtual env is recommended as all of our tests/builds/verifications are done in that way, hence you will get more coverage if follow the installation guide here: https://github.com/oracle/oci-python-sdk#installation

I am trying to understand is there any reason not use virtual environment for it?

@knobix
Copy link
Author

knobix commented Sep 20, 2019

Hi @jasonyin ,

thank you for your info. Indeed, I'm aware of the fact that virtualenv is the recommended way as described in https://github.com/oracle/oci-python-sdk#installation .

Testing/Using the SDK outside a virtualenv gives downstream packagers the possibility to do proper QA to test the SDK against Python packages that are shipped locally.

In my case the Python SDK was added to the FreeBSD ports collection recently and as with many Python ports there it depends/uses local packages.

@jasonyin
Copy link
Contributor

Got it. we will triage/prioritize this issue and will update you here, thanks!

@moraleslazaro
Copy link

The test suite fails even inside a virtual environment. There aren't any references to the module vcr_mods inside test_config_container.py, so even if the folder is copied over it won't be used. Flake8 warnings about that module not being used but the warning was suppressed with # noqa: F401 when the change was introduced. Maybe there was some intention in using the module later but I guess that intention didn't materialize since the module was never added to the tests/ folder.

@moraleslazaro moraleslazaro linked a pull request May 15, 2020 that will close this issue
@pabs3
Copy link

pabs3 commented Jan 9, 2022

I encountered this while trying to package oci-python-sdk for Debian, would appreciate a fix for this. In the meantime I will apply the patch in #253 to remove it.

@major
Copy link

major commented Apr 27, 2023

Same for packaging in Fedora. Thanks for the temporary patch. 🫂

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 a pull request may close this issue.

6 participants