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

Some issues running integration tests with pytest #90

Open
f18m opened this issue Dec 24, 2019 · 4 comments
Open

Some issues running integration tests with pytest #90

f18m opened this issue Dec 24, 2019 · 4 comments
Labels
dependencies Pull requests that update a dependency file

Comments

@f18m
Copy link

f18m commented Dec 24, 2019

Hi,
I'm not an expert of pytest and I'm trying to run integration tests.
I'm running them on Ubuntu 18.04. Since nexus3-cli is using Python3 and the distro defaults to Python2 I did the following

$ virtualenv -p /usr/bin/python3 py3env
$ source py3env/bin/activate


$ pip --version  # I have pip 19.3.1 from /home/francesco/work/nexus3-cli/py3env/lib/python3.6/site-packages/pip (python 3.6)

$ pip install  -e .
$ pip install pytest faker

$ docker run -d --rm -p 127.0.0.1:8081:8081 --name nexus sonatype/nexus3
$ ./tests/wait-for-nexus.sh  # the Nexus instance takes a while to be ready
$ ./tests/nexus-login $(docker exec nexus cat /nexus-data/admin.password)

$ pytest -m integration

stty: 'standard input': Inappropriate ioctl for device
ImportError while loading conftest '/home/francesco/work/nexus3-cli/tests/conftest.py'.
tests/conftest.py:60: in <module>
    @pytest.helpers.register
E   AttributeError: module 'pytest' has no attribute 'helpers'

what am I missing?
I have pytest == 5.3.2 and Faker==3.0.0...

thanks

@f18m
Copy link
Author

f18m commented Dec 24, 2019

I forgot to add that I tried the following after some Googling:

$ pip install pytest-helpers-namespace
...
Successfully installed pytest-helpers-namespace-2019.1.8

$ pytest -m integration
stty: 'standard input': Inappropriate ioctl for device
ERROR: usage: pytest [options] [file_or_dir] [file_or_dir] [...]
pytest: error: unrecognized arguments: --cov --cov-report term --cov-append
  inifile: /home/francesco/work/nexus3-cli/setup.cfg
  rootdir: /home/francesco/work/nexus3-cli

@f18m
Copy link
Author

f18m commented Dec 24, 2019

ok sorry I realized that actually the "[test]" part in the README.md is not optional... the syntax sidetracked me a little bit.

I now did:

$ pip install -e .[test]
$ pytest -m integration

Traceback (most recent call last):
  File "/home/francesco/work/nexus3-cli/py3env2/lib/python3.6/site-packages/coverage/sqldata.py", line 1032, in execute
    return self.con.execute(sql, parameters)
sqlite3.DatabaseError: file is not a database

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/francesco/work/nexus3-cli/py3env2/bin/pytest", line 8, in <module>
    sys.exit(main())
...
  File "/home/francesco/work/nexus3-cli/py3env2/lib/python3.6/site-packages/coverage/sqldata.py", line 1047, in execute
    raise CoverageException("Couldn't use data file {!r}: {}".format(self.filename, msg))
coverage.misc.CoverageException: Couldn't use data file '/home/francesco/work/nexus3-cli/.coverage': Looks like a coverage 4.x data file. Are you mixing versions of coverage?

$ pip list | grep coverage
coverage                 5.0.1      


Should I install the coverage 4.x ?

@thiagofigueiro
Copy link
Owner

thiagofigueiro commented Dec 24, 2019 via email

@f18m
Copy link
Author

f18m commented Dec 24, 2019

Read the .travisci steps but I think you’re missing the test dependencies; i.e.: pip install -e .[test]

right thanks! however the problem is that coverage 5.x seems incompatible with coverage 4.x... maybe the test_requires list should be adjusted to ensure 4.x is used...

@bt-thiago bt-thiago added the dependencies Pull requests that update a dependency file label Jan 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file
Projects
None yet
Development

No branches or pull requests

3 participants