Daniel Hahler
2228ccbfb4
pytester: reset log output in _match_lines ( #70 )
...
This is necessary for when using e.g. `no_fnmatch_line` after it.
Factor it out into `_fail`.
(cherry picked from commit aade7ed0045ba32557ef8565cbab28a2c91053a7)
Ref: https://github.com/pytest-dev/pytest/pull/5914#issuecomment-549182242
2019-11-20 05:24:18 +01:00
Daniel Hahler
886a3ad609
pytester: typing
2019-10-27 12:32:14 +01:00
Bruno Oliveira
d1bc2601e4
pytester: align prefixes ( #6026 )
...
pytester: align prefixes
2019-10-24 18:50:29 -03:00
Daniel Hahler
8ef4287bf0
pytester: align prefixes
...
This is important for using another match_nickname, e.g. "re.match".
TODO:
- [ ] changelog
- [ ] test
2019-10-24 23:20:12 +02:00
Bruno Oliveira
7beb520555
Show the mnemonic of pytest.ExitCode in RunResult's repr
...
Fix #4901
2019-10-23 09:16:02 -03:00
Bruno Oliveira
0c18e24433
Introduce no_fnmatch_line/no_re_match_line in pytester
...
The current idiom is to use:
assert re.match(pat, result.stdout.str())
Or
assert line in result.stdout.str()
But this does not really give good results when it fails.
Those new functions produce similar output to ther other match lines functions.
2019-10-06 18:05:24 -03:00
Bruno Oliveira
345df99db7
Show session duration in human-readable format
...
Fix #5707
2019-08-10 10:45:53 -03:00
Daniel Hahler
b5b710b3ae
Merge master into features
...
Several conflicts, mostly due to 2c402f4bd
.
Conflicts:
.pre-commit-config.yaml
src/_pytest/outcomes.py
src/_pytest/python_api.py
tox.ini
2019-08-02 16:52:51 +02:00
Anthony Sottile
27c9d80a7e
Fix ordering of sys modules snapshot
2019-07-20 11:17:30 -07:00
Bruno Oliveira
7e58defc15
Remove 'pytest.config'
2019-06-30 13:18:07 -03:00
Ronny Pfannschmidt
2b92fee1c3
initial conversion of exit codes to enum
2019-06-15 06:48:00 +02:00
Anthony Sottile
ccd87f9e80
small mypy fixes
2019-06-06 09:13:02 -07:00
Anthony Sottile
be2be040f9
Clean up u' prefixes and py2 bytes conversions
2019-06-04 17:50:34 -07:00
Anthony Sottile
a91fe1fedd
pre-commit run pyupgrade --all-files
2019-06-03 12:08:02 -03:00
Anthony Sottile
3f1ec520fc
pre-commit run reorder-python-imports --all-files
2019-06-03 12:08:01 -03:00
Anthony Sottile
5034399d7a
pre-commit run fix-encoding-pragma --all-files
2019-06-03 12:08:01 -03:00
Daniel Hahler
ace3a02cd4
pytester: factor out testdir._env_run_update
2019-05-30 17:39:44 +02:00
Daniel Hahler
f013a5e8c1
pytester: use temporary HOME with spawn
...
Followup to https://github.com/pytest-dev/pytest/issues/4956 .
2019-05-30 17:39:44 +02:00
Daniel Hahler
b84f826fc8
test_run_stdin: add sleep
2019-04-10 00:03:49 +02:00
Daniel Hahler
4fca86e2af
testdir.popen: use kwargs with defaults for stdout/stderr
2019-04-06 12:13:48 +02:00
Daniel Hahler
9ad00714ba
pytester: allow passing in stdin to run/popen
2019-04-06 12:13:28 +02:00
Daniel Hahler
d91527599a
pytester: use monkeypatch with Testdir
2019-04-03 15:02:53 +02:00
Daniel Hahler
5e27ea5528
pytester: LineMatcher: assert Sequence when matching in order
...
This can be helpful when passing a set accidentally.
2019-03-15 23:07:08 +01:00
Daniel Hahler
9bcbf552d6
Add __repr__ for RunResult
2019-02-08 23:41:20 +01:00
Bruno Oliveira
fd48cd57f9
Remove config.warn, Node.warn; pytest_logwarning issues a warning when implemented
...
Fix #3078
2018-12-14 12:50:18 -02:00
Bruno Oliveira
5b83417afc
Deprecate the 'message' parameter of pytest.raises
...
Fix #3974
2018-12-12 22:26:30 -02:00
Anthony Sottile
1bba0a9714
Deprecate `raises(..., 'code(as_a_string)')` / `warns(..., 'code(as_a_string)')
2018-11-29 09:34:51 -08:00
Anthony Sottile
2368fbb63c
Apply reorder-python-imports to all files
2018-10-25 00:01:29 -07:00
Bruno Oliveira
9a3836a0cf
Merge remote-tracking branch 'upstream/master' into merge-master-into-features
2018-10-09 19:34:04 -03:00
Kyle Altendorf
4071c8a4a8
Correct timing in test_pytester.test_testdir_run_with_timeout()
2018-10-08 21:03:42 -04:00
Anthony Sottile
1caf6d5907
Upgrade pre-commit hooks
2018-10-08 10:10:46 -07:00
Kyle Altendorf
48dcc67274
Increase timeout in test_testdir_run_with_timeout to decrease false failures
2018-10-06 22:02:33 -04:00
Kyle Altendorf
8e0e862c84
Stretch out the time assertion for slow AppVeyor
2018-10-05 01:38:01 -04:00
Kyle Altendorf
0d095fc978
Up timeout to 1 second for test
2018-10-04 23:09:07 -04:00
Kyle Altendorf
dcd635ba0c
Correct timeout to check every so often
2018-10-04 23:08:57 -04:00
Bruno Oliveira
fe7050ba00
Fix lint
2018-10-04 18:45:30 -03:00
Kyle Altendorf
96b2ae6654
Initial pass at timeout for subprocessing pytest
...
pytest-dev/pytest#4073
2018-10-03 23:56:57 -04:00
Bruno Oliveira
2f2d5861bb
Merge remote-tracking branch 'upstream/master' into merge-master-into-features
2018-08-26 16:45:00 -03:00
Bruno Oliveira
b0541e9d31
Correctly restore sys.path in test and remove dead code in test_pytester
...
The code in test_pytester has been refactored into a class right
above the dead code, and the code has been left there by mistake
apparently.
2018-08-25 18:17:52 -03:00
wim glenn
b08e156b79
strip trailing whitespace
2018-08-22 11:27:36 -05:00
wim glenn
8e2c7b4979
Add a failing testcase for PR #3848
2018-08-22 11:00:51 -05:00
wim glenn
539a22c750
Added support for xfailed and xpassed outcomes to the ``pytester.RunResult.assert_outcomes`` signature.
2018-08-20 01:24:19 -05:00
Anthony Sottile
61301d934e
Remove some extraneous `# noqa` comments
...
This was partially automated with https://github.com/asottile/yesqa
_with a few caveats_:
- it was run under python2 (chosen arbitrarily, when run under python3 other
things were changed)
- I used `git checkout -p` to revert the removal of `noqa` comments from
`cmp()` lines.
2018-07-08 17:05:52 -07:00
Anthony Sottile
42bbb4fa8a
Use -mpytest when invoking pytest in pytester
2018-07-07 17:18:44 -07: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
Bruno Oliveira
af37778b0d
All classes now subclass object for better py3 compatibility
...
Fix #2147
2018-01-24 18:23:42 -02:00
Jurko Gospodnetić
f3c9c6e8a8
fix restoring Python state after in-process pytest runs
...
Now each in-process pytest run saves a snapshot of important global Python
state and restores it after the test completes, including the list of loaded
modules & the Python path settings.
Previously only the loaded package data was getting restored, but that was
also reverting any loaded package changes done in the test triggering the
pytest runs, and not only those done by the pytest runs themselves.
Updated acceptance tests broken by this change, which were only passing before
by accident as they were making multiple pytest runs with later ones depending
on sys.path changes left behind by the initial one.
2017-12-17 12:47:50 +01:00
Jurko Gospodnetić
8e8a953ac6
fix test name typo
2017-12-09 13:34:58 +01:00
Bruno Oliveira
221797c609
Encode utf-8 byte strings in pytester's makefile
...
Fix #2738
2017-08-31 18:49:06 -03:00