Commit Graph

58 Commits

Author SHA1 Message Date
Daniel Hahler 08f3b02dfc tests: fnmatch_lines: use list
For strings fnmatch_lines converts it into a Source objects, splitted on
newlines.  This is not necessary here, and it is more consistent to use
lists here in the first place.
2019-03-23 11:36:18 +01:00
Bruno Oliveira ade5f2c8c5 Merge remote-tracking branch 'upstream/master' into merge-master-into-features 2019-01-29 19:36:56 -02:00
Ronny Pfannschmidt f7d7555521 fix #4680 - ensure tmpdir and tmp_path are the same 2019-01-27 13:05:34 +01:00
Adam Uhlir 04bd147d46
Fixes #4653 - tmp_path provides real path 2019-01-18 12:54:00 -08:00
Ronny Pfannschmidt 5f1d692072 use Path.resolve in test to sort out osx temporary folder being a symlink 2018-11-22 16:10:12 +01:00
Ronny Pfannschmidt fc61bdd907 fix 4425: resolve --basetemp to absolute paths 2018-11-20 16:14:50 +01:00
Bruno Oliveira dc20dedbc7 Change RemovedInPytest4Warnings to errors by default
To keep existing tests which emit RemovedInPytest4Warnings running, decided
to go with a command line option because:

* Is harder to integrate an ini option with tests which already use an ini file
* It also marks tests which need to be removed/updated in 4.1, when
  RemovedInPytest4Warning and related functionality are removed.

Fix #3737
2018-11-12 16:10:57 -02:00
Bruno Oliveira d59786fcc4
Merge pull request #4222 from RonnyPfannschmidt/pathlib-fixes
handle race condition when creation and deletion of a numbered dir overlap
2018-10-26 14:36:43 -03:00
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