Commit Graph

100 Commits

Author SHA1 Message Date
Ronny Pfannschmidt ae2fc27799 handle test folder cleanup being unable to create a cleanup lock 2018-10-26 14:31:54 +02:00
Anthony Sottile 2368fbb63c Apply reorder-python-imports to all files 2018-10-25 00:01:29 -07:00
Ronny Pfannschmidt 56dd7bc551 TestNumberedDir: ignore that symlinks arent created on windows 2018-10-17 21:39:23 +02:00
Ronny Pfannschmidt 8dca8f3c9f fix test_cleanup_keep for expecting symlinks 2018-10-17 21:16:44 +02:00
Ronny Pfannschmidt cc335d44a0 fix #4179 - bring back the current testrun symlink 2018-10-17 20:43:27 +02:00
Bruno Oliveira ced62f30ba Attempt to create symlinks even on Windows, skipping when not possible 2018-10-14 18:21:04 -03:00
Ronny Pfannschmidt 1dfa303b1e fix #4135 - handle symlinks in tmp path cleanup 2018-10-14 21:20:34 +02:00
Ronny Pfannschmidt b82d6f7a0b pytester: use per test tmproot 2018-10-11 07:15:09 +02:00
Ronny Pfannschmidt 3036914097 sort out rmtree expectations 2018-10-11 07:15:09 +02:00
Ronny Pfannschmidt 85cc9b8f12 move all the things into _pytest.pathlib 2018-10-11 07:15:08 +02:00
Ronny Pfannschmidt d76fa59b35 fix lock timeouts for good this time 2018-10-11 07:15:08 +02:00
Ronny Pfannschmidt 642cd86dd1 shape up removal and lock destruction 2018-10-11 07:15:08 +02:00
Ronny Pfannschmidt ab3637d486 implement cleanup for unlocked folders 2018-10-11 07:15:08 +02:00
Ronny Pfannschmidt 66a690928c bring in purepath and fix an assertion 2018-10-11 07:15:08 +02:00
Ronny Pfannschmidt b48e23d54c port interals of tmpdir to a basic pathlib implementation
this is still lacking locking and cleanup of the folders
2018-10-11 07:15:08 +02:00
Bruno Oliveira 57b0c60cb4 Remove Testdir.run_example as recommended 2018-07-26 20:10:40 -03:00
Bruno Oliveira 011f88f7e7 Deprecate calling fixture functions directly
This will now issue a RemovedInPytest4Warning when the user calls
a fixture function directly, instead of requesting it from test
functions as is expected

Fix #3661
2018-07-26 19:58:42 -03:00
Anthony Sottile cbaa7dd56a Upgrade pre-commit hooks except pyupgrade 2018-06-26 06:35:27 -07:00
Ronny Pfannschmidt 703e4b11ba run black 2018-05-23 16:48:46 +02:00
Andras Tim b840622819 Fixed E302 flake8 errors
expected 2 blank lines, found 0
2017-07-17 01:44:23 +02:00
Bruno Oliveira 42a5d6bdfa Add __future__ imports to all pytest modules
This prevents silly errors from creeping in Python 2 when testing in Python 3
2017-03-16 22:45:40 -03:00
Michal Wajszczuk fb0b90646e New-style classes implemented for python 2.7 - #2147 2017-02-16 20:28:17 +01:00
Bruno Oliveira 6c8b0a28e1 Add deprecation module to centralize deprecation messages and bits of code 2016-07-25 18:14:39 -03:00
Ronny Pfannschmidt 04deea3c6d fix flaky get_user fallback tests 2015-09-29 21:00:12 +02:00
Andy Freeland b1c9b8b415 Make tmpdir resiliant to user ids that do not exist
Previously, the tmpdir fixture would fail if the current process's user
id does not correspond to a valid user (e.g. running pytest in a Docker
container with 'docker run -u').
2015-09-18 21:26:19 -04:00
Bruno Oliveira 130e6cf8a2 Use temproot as a fallback if the current user couldn't be obtained 2015-09-16 16:42:07 -03:00
Bruno Oliveira 558e5406e8 test_get_user should execute on windows only 2015-09-16 13:06:39 -03:00
Bruno Oliveira 1150e87e31 Extract get_user logic into a separate function 2015-09-16 12:47:50 -03:00
Bruno Oliveira 6676aeda5a Make tmpdir more resilient in case environment variables required by getpass are missing
Fix #1010
2015-09-16 12:20:07 -03:00
Bruno Oliveira 4302972c23 Use pytest-of-$user as base directory for tmpdir_factory
Before tmpdir_factory, pytest used to create a link named "pytest-$user" to the current numbered directory. Use
 a different name so there's no conflict when running different pytest versions.

Fix #894
2015-07-28 20:57:48 -03:00
Bruno Oliveira 74bc50e97c Fix flakes 2015-07-15 20:45:35 -03:00
Bruno Oliveira 0f52856f99 Use a subdirectory in the TEMP directory to speed up tmpdir creation
Fix #105
2015-07-15 20:03:58 -03:00
holger krekel 2b8a54d5d9 refine skipif to use direct booleans, to help with flakes 2014-01-29 11:46:36 +01:00
holger krekel 505a34bb85 fix flakes failures 2014-01-29 10:20:13 +01:00
Jurko Gospodnetić 9fb2079458 replace py.test module references with pytest
The only remaining 'py.test' references are:
 * those referring to the 'py.test' executable
 * those in code explicitly testing py.test/pytest module compatibility
 * those in old CHANGES documentation
 * those in documentation generated based on external data
 * those in seemingly unfinished & unmaintained Japanese documentation

Minor stylistic changes and typo corrections made to documentation next to
several applied py.test --> pytest content changes.
2014-01-18 12:31:33 +01:00
holger krekel 8ac5af2896 fix flakes issues and make --flakes run part of tox runs 2013-10-12 15:39:22 +02:00
holger krekel 9fdfa155fb fix issue354: avoid tmpdir fixture to create too long filenames especially
when parametrization is used
2013-10-03 14:22:54 +02:00
holger krekel fad7bd4393 simplify Config constructor 2013-09-28 22:22:53 +02:00
holger krekel b2cb93e06d allow re-running of a test item (as exercised by the
pytest-rerunfailures plugins) by re-initializing and removing
request/funcargs information in runtestprotocol() - which is a slightly
odd place to add funcarg-related functionality but it allows all
pytest_runtest_setup/teardown hooks to properly see a valid
request/funcarg content on test items.
2013-04-22 10:35:48 +02:00
holger krekel f3e03fc298 modernize tmpdir fixture (use request.node in tmpdir fixture, use @pytest.fixture) 2012-11-19 14:07:14 +01:00
holger krekel 6eec2f5893 make tmpdir fixture always return a realpath()ed tmpdir and make a note
about it in the changed test.  Currently, i don't see a reason why this
is a bad idea (tm)
2012-10-11 13:05:16 +02:00
holger krekel e14459d45c discover funcarg factories independently from request/Function items 2012-07-20 14:16:28 +02:00
holger krekel 91b6f2bda8 mid-scale refactoring to make request API available directly on items.
This commit was slightly tricky because i want to backward
compatibility especially for the oejskit plugin which
uses Funcarg-filling for non-Function objects.
2012-06-25 17:35:33 +02:00
holger krekel 974e4e3a9d skip the symlink test on windows, win32/py32 does not support it without privs 2011-11-07 22:00:12 +00:00
holger krekel 369b7709f7 use os.symlink to make things work on windows/py32 2011-11-07 21:02:07 +00:00
holger krekel a2f4a11301 refine lsof/FD leakage testing and rework test setup and some of pytest own tests. Note that the actual diff to non-test code is small. Also remove some redundant tests (introduced by a copy-paste-error apparently in test_mark.py). 2011-11-07 18:08:41 +00:00
holger krekel 077c468589 don't remove symlinks from temporary directory path - should help with some standard OSX setups 2011-11-06 19:34:02 +00:00
holger krekel f456e376b9 refine tmpdir handling and docs
- clear tmpdir specified with --basetemp
- remove config.mktmp and config.getbasetemp methods
2010-11-21 17:43:18 +01:00
holger krekel a698465487 streamline docs, especially use "import pytest" and "pytest.*" in python code examples instead of "import py" and "py.test.*". 2010-11-17 22:12:16 +01:00
holger krekel 076e03e90f also un-nest test directory 2010-11-13 11:30:40 +01:00