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

pytest: set rules to find test files and functions #374

Closed
wants to merge 1 commit into from

Conversation

tiran
Copy link
Member

@tiran tiran commented Jan 5, 2017

1e06a51 removed pytest.ini. Without the
ini file, pytest 3.x has suboptimal settings and no longer picks up all
test functions and test files.

Signed-off-by: Christian Heimes cheimes@redhat.com

1e06a51 removed pytest.ini. Without the
ini file, pytest 3.x has suboptimal settings and no longer picks up all
test functions and test files.

Signed-off-by: Christian Heimes <cheimes@redhat.com>
@tiran tiran requested a review from apophys January 5, 2017 18:32
@tiran
Copy link
Member Author

tiran commented Jan 6, 2017

Reproducer:

$ tox -e py27
py27 create: /home/heimes/redhat/freeipa/.tox/py27
py27 installdeps: ipaclient, ipatests
['/home/heimes/redhat/freeipa/.tox-install.sh', '/home/heimes/redhat/freeipa/.tox/py27/bin/python', '/home/heimes/redhat/freeipa/.tox/py27/lib/python2.7/site-packages', 'ipaclient', 'ipatests']
py27 installed: cffi==1.9.1,configparser==3.5.0,cryptography==1.7.1,custodia==0.2.0,decorator==4.0.10,dnspython==1.15.0,enum34==1.1.6,gssapi==1.2.0,idna==2.2,ipaclient==4.4.90.dev201701051932+gitadb0120,ipaddress==1.0.17,ipalib==4.4.90.dev201701051932+gitadb0120,ipapython==4.4.90.dev201701051932+gitadb0120,ipatests==4.4.90.dev201701051932+gitadb0120,jwcrypto==0.4.0,netaddr==0.7.18,netifaces==0.10.5,nose==1.3.7,polib==1.0.8,py==1.4.32,pyasn1==0.1.9,pyasn1-modules==0.0.8,pycparser==2.17,pyldap==2.4.25.1,pytest==3.0.5,pytest-multihost==1.1,python-nss==1.0.1,python-yubico==1.3.2,pyusb==1.0.0,qrcode==5.3,requests==2.12.4,six==1.10.0
py27 runtests: PYTHONHASHSEED='3237466879'
py27 runtests: commands[0] | ipa-run-tests test_ipapython test_ipalib test_pkcs10 --ignore=test_ipalib/test_rpc.py
=================================================================== test session starts ====================================================================
platform linux2 -- Python 2.7.12, pytest-3.0.5, py-1.4.32, pluggy-0.4.0
rootdir: /home/heimes/redhat, inifile: tox.ini
plugins: multihost-1.1
collected 0 items 

=============================================================== no tests ran in 0.12 seconds ===============================================================
ERROR: InvocationError: '/home/heimes/redhat/freeipa/.tox/py27/bin/ipa-run-tests test_ipapython test_ipalib test_pkcs10 --ignore=test_ipalib/test_rpc.py'
_________________________________________________________________________ summary __________________________________________________________________________
ERROR:   py27: commands failed
  • edit ipatests/conftest.py and enable python_files on line 47
  • run tox -e py27 again
=================================================================== test session starts ====================================================================
platform linux2 -- Python 2.7.12, pytest-3.0.5, py-1.4.32, pluggy-0.4.0
rootdir: /home/heimes/redhat, inifile: tox.ini
plugins: multihost-1.1
collected 406 items 

test_ipapython/test_cookie.py ............
test_ipapython/test_dn.py ...........................
test_ipapython/test_ipautil.py ..................................................................
test_ipapython/test_ipavalidate.py ..........
test_ipapython/test_kerberos.py ..............
test_ipapython/test_keyring.py ..........
test_ipapython/test_ssh.py ...............................
test_ipalib/test_aci.py ...................
test_ipalib/test_backend.py ........
test_ipalib/test_base.py ...............
test_ipalib/test_capabilities.py .
test_ipalib/test_cli.py ...
test_ipalib/test_config.py ...............
test_ipalib/test_crud.py ...............
test_ipalib/test_errors.py .......
test_ipalib/test_frontend.py ........................................
test_ipalib/test_messages.py ....
test_ipalib/test_output.py ...
test_ipalib/test_parameters.py .............................................................
test_ipalib/test_plugable.py ........
test_ipalib/test_text.py .............................
test_ipalib/test_x509.py ...
test_pkcs10/test_pkcs10.py .....

================================================================== pytest-warning summary ==================================================================
...
====================================================== 406 passed, 59 pytest-warnings in 2.04 seconds ====================================================
_________________________________________________________________________ summary ________________________________________________________________________
  py27: commands succeeded
  congratulations :)

Copy link
Contributor

@apophys apophys left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To my findings, only the python_classes are necessaty. However I'd go with the explicit enumeration of all the options.

@apophys apophys added the ack Pull Request approved, can be merged label Jan 9, 2017
@MartinBasti
Copy link
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ack Pull Request approved, can be merged pushed Pull Request has already been pushed
Projects
None yet
3 participants