pytest test collection takes a lot of time (~10min for 2000 tests)
See original GitHub issue- a detailed description of the bug or suggestion I have around 2000 tests, of which collection time takes ~10 min while running them takes 2.5 min.
- output of
pip list
from the virtual environment you are using $ pip3 list DEPRECATION: The default format will switch to columns in the future. You can use --format=(legacy|columns) (or define a format=(legacy|columns) in your pip.conf under the [list] section) to disable this warning. asn1crypto (0.24.0) atomicwrites (1.3.0) attrs (19.1.0) Automat (0.6.0) bcrypt (3.1.6) blinker (1.4) boto3 (1.9.111) botocore (1.12.111) certifi (2019.6.16) cffi (1.12.2) chardet (3.0.4) click (6.7) cloud-init (19.1) colorama (0.3.7) command-not-found (0.3) configobj (5.0.6) constantly (15.1.0) cryptography (2.6.1) decorator (4.4.0) dill (0.2.9) distro-info (0.18ubuntu0.18.04.1) docutils (0.14) hibagent (1.0.1) httplib2 (0.9.2) hyperlink (17.3.1) idna (2.8) importlib-metadata (0.21) incremental (16.10.1) Jinja2 (2.10) jmespath (0.9.4) jsonpatch (1.16) jsonpointer (1.10) jsonschema (2.6.0) keyring (10.6.0) keyrings.alt (3.0) language-selector (0.1) MarkupSafe (1.0) more-itertools (7.2.0) netifaces (0.10.4) oauthlib (2.0.6) packaging (19.1) PAM (0.4.2) paramiko (2.0.0) pip (9.0.1) pkg-resources (0.0.0) pluggy (0.12.0) py (1.8.0) pyasn1 (0.4.5) pyasn1-modules (0.2.1) pycparser (2.19) pycrypto (2.6.1) pygobject (3.26.1) PyJWT (1.5.3) PyNaCl (1.3.0) pyOpenSSL (17.5.0) pyparsing (2.4.2) pyserial (3.4) pytest (5.1.2) pytest-jira (0.3.11) pytest-reportportal (1.0.7) python-apt (1.6.4) python-dateutil (2.8.0) python-debian (0.1.32) pyxdg (0.25) PyYAML (3.12) reportportal-client (3.2.0) requests (2.22.0) requests-unixsocket (0.1.5) retry (0.9.2) s3transfer (0.2.0) SecretStorage (2.3.1) service-identity (16.0.0) setuptools (39.0.1) six (1.12.0) ssh-import-id (5.7) systemd-python (234) Twisted (17.9.0) ufw (0.36) unattended-upgrades (0.1) urllib3 (1.25.3) wcwidth (0.1.7) wheel (0.30.0) zipp (0.6.0) zope.interface (4.3.2) - pytest and operating system versions 5.1.2 on Ubuntu 18.04.3 LTS
- minimal example if possible
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (5 by maintainers)
Top Results From Across the Web
How to speed up pytest - python - Stack Overflow
The collection was taking 6-7 seconds before 0.4 seconds of actual test execution. My solution initially was to call pytest with the relative ......
Read more >pytest - simple, rapid and fun testing with Python (3 hours)
Speaker:: Florian BruhinTrack: PyCon: TestingThe pytest tool presents a rapid and simple way to write tests for your Python code.
Read more >Pytest with Marking, Mocking, and Fixtures in 10 Minutes
The unit test output returns the total number of tests run, the number of tests passed, skipped, and failed, the total time taken...
Read more >Pytest | PyCharm Documentation - JetBrains
PyCharm supports pytest, a fully functional testing framework. The following features are available: The dedicated test runner. Code completion for test ...
Read more >How we run our Python tests in hundreds of environments ...
Our test setup was created years ago and over time lots of tests were ... We collected a couple of ideas on how...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Looking at that profile, something is doing network requests at import time. See e.g.:
Filtering the profile output for lines containing
test_aws_
ortest_azure_
will probably narrow this down enough to spot the function(s) making collection-time network requests.I don’t think this is a pytest bug though, so I’ll close the issue.