oracle / oracle/oci-python-sdk

Testsuite fails if run independently outside of a virtualenv

Open
#164 7 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
474
Forks
321
Avg merge
23m
Merged PRs (30d)
4

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running pytest outside a virtualenv and inspect tests/conftest.py, tests/integ/util.py, and tests/test_config_container.py around the vcr_mods import. Review setup.py and the sdist contents, then verify that the stated test requirements and tests/vcr_mods are available for an independent test run and that the reported tests pass.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
build-system, testing-qa
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.