Nicholas Devenish
1a8d9bf254
Let approx() work on more generic sequences
...
approx() was updated in 9f3122fe
to work better with numpy arrays,
however at the same time the requirements were tightened from
requiring an Iterable to requiring a Sequence - the former being
tested only on interface, while the latter requires subclassing or
registration with the abc.
Since the ApproxSequence only used __iter__ and __len__ this commit
reduces the requirement to only what's used, and allows unregistered
Sequence-like containers to be used.
Since numpy arrays qualify for the new criteria, reorder the checks so
that generic sequences are checked for after numpy arrays.
2018-11-18 20:01:11 +00:00
Anthony Sottile
10cdae8e38
Merge pull request #4414 from asottile/starred_with_side_effect
...
Fix assertion rewriting involving Starred + side-effects
2018-11-17 16:17:24 -08:00
Daniel Hahler
5fab0ca312
Merge pull request #4403 from RonnyPfannschmidt/fix-4400
...
Fix #4400 - rearrange the handling of yield test warnings/errors
2018-11-18 00:57:44 +01:00
Anthony Sottile
690a63b921
Fix assertion rewriting involving Starred + side-effects
2018-11-17 10:42:51 -08:00
Daniel Hahler
a252e81ced
Fix collection of testpaths with `--pyargs`
...
Fixes https://github.com/pytest-dev/pytest/issues/4405 .
2018-11-17 13:28:10 +01:00
Ronny Pfannschmidt
950d30e6e0
fix #4400 - rearrange the handling of yield test warnings/errors
2018-11-16 13:49:46 +01:00
Daniel Hahler
0385c27343
cacheprovider: do not write README/.gitignore to existing dir
...
Fixes https://github.com/pytest-dev/pytest/issues/4393 .
2018-11-14 22:09:09 +01:00
Bruno Oliveira
e025974cbd
Merge remote-tracking branch 'upstream/master' into release-4.0.0
2018-11-13 20:58:24 +00:00
Bruno Oliveira
fea09cda6c
Merge pull request #4383 from nicoddemus/merge-master-into-features
...
Merge master into features (about to prepare 4.0)
2018-11-13 18:57:41 -02:00
Aly Sivji
b83e97802e
improve failure output
2018-11-13 09:37:02 -06:00
Daniel Hahler
a72eff5a08
Merge pull request #4382 from blueyed/pytester-pop-TOX_ENV_DIR
...
pytester: pop TOX_ENV_DIR from os.environ
2018-11-13 12:42:51 +01:00
Bruno Oliveira
557cb6cffe
Merge remote-tracking branch 'upstream/master' into merge-master-into-features
2018-11-13 09:01:37 -02:00
Daniel Hahler
a6a96469ca
pytester: pop TOX_ENV_DIR from os.environ
...
Closes: https://github.com/pytest-dev/pytest/pull/4378
Fixes: https://github.com/pytest-dev/pytest/issues/4366
2018-11-13 09:02:52 +01:00
Daniel Hahler
27dab4e05f
Fix CallInfo.__repr__ for unfinished call
...
Fixes https://github.com/pytest-dev/pytest/issues/3554
Ref: https://github.com/pytest-dev/pytest/pull/3560
Ref: https://github.com/pytest-dev/pytest/pull/3562
2018-11-13 08:51:43 +01:00
Aly Sivji
2bffd6829e
Move dataclass tests for 3.7 to separate file
2018-11-12 15:36:16 -06:00
Bruno Oliveira
f8f22d29ee
Use a custom cache directory for test_stepwise tests
...
Otherwise the tests will use tox's env cache which makes them flaky
2018-11-12 16:57:39 -02: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
Aly Sivji
4e99c80425
have tests pass in python37; move to separate file
2018-11-12 11:24:15 -06:00
Aly Sivji
025d160dfc
Update tests to pass in py27
2018-11-12 09:28:47 -06:00
Aly Sivji
1847cc7420
adding docs and cleaning up
2018-11-12 09:28:47 -06:00
Aly Sivji
1184db8273
cleaning up
2018-11-12 09:28:47 -06:00
Aly Sivji
d42f1e87c3
Add tests for attrs and dataclasses
2018-11-12 09:28:47 -06:00
Daniel Hahler
be15ad8d25
Fix collection of direct symlinked files not in python_files
...
Fixes https://github.com/pytest-dev/pytest/issues/4325 .
2018-11-11 01:37:06 +01:00
Daniel Hahler
f551cb9677
Skip Instances with --collect-only
2018-11-10 23:48:02 +01:00
Daniel Hahler
87254ca593
Add test for --deselect without "::()"
...
Closes: https://github.com/pytest-dev/pytest/issues/4127 .
2018-11-10 23:46:41 +01:00
Daniel Hahler
ac8b9c6e9d
Node: do not add "::()" to nodeid
...
Fixes https://github.com/pytest-dev/pytest/issues/4127 .
2018-11-10 23:46:41 +01:00
Daniel Hahler
b51c1c3b8d
tests: fix equal_with_bash for .coverage files
...
Fixes https://github.com/pytest-dev/pytest/issues/4162 .
2018-11-10 03:24:02 +01:00
Daniel Hahler
bee72a6622
Fix nodes._check_initialpaths_for_relpath for dirs
...
Ref: https://github.com/pytest-dev/pytest/issues/4321#issuecomment-436951894
Hardens some of the not many tests affected by this:
1. `testing/test_session.py::test_rootdir_option_arg` displayed:
> root/test_rootdir_option_arg2/test_rootdir_option_arg.py
2. `test_cmdline_python_namespace_package` displayed "hello/" prefix for:
> hello/test_hello.py::test_hello
> hello/test_hello.py::test_other
2018-11-09 13:16:59 +01:00
Daniel Hahler
1b260a844f
Merge branch 'master' into features
2018-11-09 12:49:55 +01:00
Bruno Oliveira
e00f3a2fb7
Merge pull request #4353 from blueyed/test_fileimport
...
tests: test_fileimport: improve reporting on failure
2018-11-09 08:32:49 -02:00
Daniel Hahler
a507f44465
cache_dir: use $TOX_ENV_DIR/ prefix if set
...
Fixes https://github.com/pytest-dev/pytest/issues/4270
2018-11-09 05:29:28 +01:00
Daniel Hahler
4a74d455de
minor: typos
2018-11-09 02:03:44 +01:00
Daniel Hahler
a0890f98d8
tests: harden test_config_error
2018-11-09 01:31:53 +01:00
Daniel Hahler
b494d3d1c1
tests: test_fileimport: improve reporting on failure
2018-11-09 01:17:36 +01:00
Bruno Oliveira
423e19909e
Merge pull request #4307 from fzarifian/fzarifian-pr4304
...
#4304 the stepwise plugin must be blocked on cacheprovider plugin block request
2018-11-08 20:42:04 -02:00
Daniel Hahler
3137c89cf1
Fix/improve handling of chdir with no-args and testpaths
...
Fixes https://github.com/pytest-dev/pytest/issues/4332 .
2018-11-08 17:50:45 +01:00
Daniel Hahler
9d838fa861
Merge branch 'master' into features
...
Conflicts:
src/_pytest/main.py
2018-11-08 02:48:59 +01:00
Bruno Oliveira
17b8e2d45b
Fix linting
2018-11-07 18:32:23 -02:00
Daniel Hahler
f840521854
harden test_collect_init_tests
2018-11-07 19:29:55 +01:00
Daniel Hahler
134b103605
XXX: revert _collect_seen_pkgdirs
2018-11-07 11:01:39 +01:00
Daniel Hahler
fa35f650b5
Fix handling of duplicate args with regard to Python packages
...
Fixes https://github.com/pytest-dev/pytest/issues/4310 .
2018-11-07 10:06:09 +01:00
Daniel Hahler
cb57159e01
Handle os.chdir() during collection
2018-11-05 23:18:47 +01:00
Anthony Sottile
a4819844a4
Use unicode/bytes literals instead of calls
2018-11-04 17:43:24 -08:00
Anthony Sottile
4bf6a07fe2
Merge pull request #4305 from RonnyPfannschmidt/cleanup-tobytes
...
replace byte/unicode helpers in test_capture with python level syntax
2018-11-04 17:29:41 -08:00
Fabien ZARIFIAN
a447dc86fb
Add test to branch
2018-11-05 00:14:35 +01:00
Ronny Pfannschmidt
7cb271b46f
replace byte/unicode helpers in test_capture with python level syntax
2018-11-04 22:01:01 +01:00
Bruno Oliveira
d1c9c54571
Merge pull request #4297 from nicoddemus/release-3.10.0
...
Release 3.10.0
2018-11-04 12:25:30 -03:00
Bruno Oliveira
6befdf8b46
Merge remote-tracking branch 'upstream/master' into release-3.10.0
2018-11-03 13:42:20 +00:00
Daniel Hahler
e61e81a7b5
Make debugging's pytest_configure re-entrant
...
This is relevant when using runpytest in-process.
Fixes:
E def test_1(testdir):
E testdir.runpytest()
E > __import__('pdb').set_trace()
E
E ../../test_trace_after_runpytest.py:3:
E …/Vcs/pytest/src/_pytest/debugging.py:81: in set_trace
E tw = _pytest.config.create_terminal_writer(cls._config)
E
E config = None, args = (), kwargs = {}, tw = <py._io.terminalwriter.TerminalWriter object at 0x7f1097088160>
E
E def create_terminal_writer(config, *args, **kwargs):
E """Create a TerminalWriter instance configured according to the options
E in the config object. Every code which requires a TerminalWriter object
E and has access to a config object should use this function.
E """
E tw = py.io.TerminalWriter(*args, **kwargs)
E > if config.option.color == "yes":
E E AttributeError: 'NoneType' object has no attribute 'option'
2018-11-02 18:25:01 +01:00
Bruno Oliveira
21725e9304
Merge pull request #4285 from kchmck/fix-4046
...
Fix problems with running tests in package `__init__` files (#4046 )
2018-11-02 08:26:07 -03:00
Bruno Oliveira
48f52b1be0
Merge pull request #4279 from williamjamir/improve-warning-msg
...
Improve the warning message for the implicitly str conversion
2018-11-02 08:22:15 -03:00
Daniel Hahler
e30f7094f3
python: collect: ignore exceptions with isinstance
...
Fixes https://github.com/pytest-dev/pytest/issues/4266 .
2018-11-01 22:14:13 +01:00
Mick Koch
320e41b142
Add failing test for __init__.py also including other package files
2018-11-01 13:10:52 -04:00
Mick Koch
70976b04be
Add test for __init__.py collection with package directory as argument
2018-11-01 13:10:17 -04:00
Daniel Hahler
d65f300988
Move handling of duplicate files
...
This removes the hack added in https://github.com/pytest-dev/pytest/pull/3802 .
Adjusts test:
- it appears to not have been changed to 7 intentionally.
- removes XXX comment, likely not relevant anymore since 6dac7743
.
2018-11-01 13:06:36 -04:00
Anthony Sottile
948fd7b8b0
fixup pyupgrade crlf incorrect fixes
2018-11-01 08:40:35 -07:00
Daniel Hahler
a192e6b430
Merge pull request #4247 from blueyed/lru
...
_getconftestmodules: use functools.lru_cache
2018-11-01 15:55:38 +01:00
Daniel Hahler
ce1cc3dddb
_getconftestmodules: use functools.lru_cache
...
Also renames `_path2confmods` to `_dirpath2confmods` for clarity (it is
expected to be a dirpath in `_importconftest`).
Uses an explicit maxsize, since it appears to be only relevant for a
short period [1].
Removes the lru_cache on _getconftest_pathlist, which makes no
difference when caching _getconftestmodules, at least with the
performance test of 100x10 files (#4237 ).
1: https://github.com/pytest-dev/pytest/pull/4237#discussion_r228528007
2018-10-31 23:17:05 +01:00
William Jamir Silva
5404246e64
Improve the warning message for the implicitly str conversion
...
Signed-off-by: William Jamir Silva <williamjamir@gmail.com>
2018-10-31 16:19:10 -03:00
Daniel Hahler
e0038b82f7
pdb: improve msg about output capturing with set_trace
...
Do not display "IO-capturing turned off/on" when ``-s`` is used to avoid
confusion.
2018-10-31 17:09:01 +01:00
Bruno Oliveira
f20eeebde9
Fix access denied error when deleting a stale temporary directory
...
Fix #4262
2018-10-30 15:35:53 -03:00
Bruno Oliveira
3b7fbcd47f
Merge remote-tracking branch 'upstream/master' into merge-master-into-features
2018-10-27 14:29:01 -03:00
Ronny Pfannschmidt
9fe871016d
Merge pull request #4147 from davidszotten/stepwise
...
Stepwise
2018-10-27 15:05:05 +02:00
Bruno Oliveira
ebba3ebe67
Merge pull request #4240 from RonnyPfannschmidt/perf-example-collect-files
...
add script to generate a example folder for collecting many files
2018-10-26 19:19:02 -03: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
Bruno Oliveira
8d0e1a99e4
Merge pull request #4241 from blueyed/move-duplicates
...
Move handling of duplicate files
2018-10-26 08:07:48 -03:00
Ronny Pfannschmidt
ce0b0518c7
fix #4243 - support positional argument stacklevel on python2
2018-10-26 09:01:25 +02:00
Anthony Sottile
777e9e1e17
Merge remote-tracking branch 'origin/master' into merge-master
2018-10-25 18:00:39 -07:00
Ronny Pfannschmidt
bfa1993840
add script to generate a example folder for collecting many files
2018-10-25 22:07:20 +02:00
Daniel Hahler
e041823643
Move handling of duplicate files
...
This removes the hack added in https://github.com/pytest-dev/pytest/pull/3802 .
Adjusts test:
- it appears to not have been changed to 7 intentionally.
- removes XXX comment, likely not relevant anymore since 6dac7743
.
2018-10-25 20:48:08 +02:00
Daniel Hahler
ede3a4e850
pytest_{enter,leave}_pdb: pass through pdb instance
2018-10-25 13:28:24 +02:00
Daniel Hahler
a4ea66cb1f
pdb: resume capturing after `continue`
...
After `pdb.set_trace()` capturing is turned off.
This patch resumes it after using the `continue` (or `c` / `cont`)
command.
Store _pytest_capman on the class, for pdbpp's do_debug hack to keep it.
Without this, `debug …` would fail like this:
/usr/lib/python3.6/cmd.py:217: in onecmd
return func(arg)
.venv/lib/python3.6/site-packages/pdb.py:608: in do_debug
return orig_do_debug(self, arg)
/usr/lib/python3.6/pdb.py:1099: in do_debug
sys.call_tracing(p.run, (arg, globals, locals))
/usr/lib/python3.6/bdb.py:434: in run
exec(cmd, globals, locals)
/usr/lib/python3.6/bdb.py:51: in trace_dispatch
return self.dispatch_line(frame)
/usr/lib/python3.6/bdb.py:69: in dispatch_line
self.user_line(frame)
/usr/lib/python3.6/pdb.py:261: in user_line
self.interaction(frame, None)
.venv/lib/python3.6/site-packages/pdb.py:203: in interaction
self.setup(frame, traceback)
E AttributeError: 'PytestPdb' object has no attribute '_pytest_capman'
- add pytest_leave_pdb hook
- fixes test_pdb_interaction_capturing_twice: would fail on master now,
but works here
2018-10-25 13:28:24 +02:00
Anthony Sottile
2368fbb63c
Apply reorder-python-imports to all files
2018-10-25 00:01:29 -07:00
Bruno Oliveira
2ad43ee442
Show node that originated a warning in the warnings summary
...
Fix #4221
2018-10-24 18:49:53 -03:00
Bruno Oliveira
b6fa4e248f
Merge pull request #4028 from asottile/revert_breakpoint_code
...
Revert patching of breakpointhook as it appears to do nothing
2018-10-24 17:50:19 -03:00
Daniel Hahler
eee8201e4f
Merge remote-tracking branch 'origin/master' into merge-master
2018-10-24 22:36:34 +02:00
Daniel Hahler
fadac0ffc0
Fix "Plugin already registered" error with symlinks
...
Fixes https://github.com/pytest-dev/pytest/issues/4174 .
2018-10-23 10:15:23 +02:00
Ankit Goel
cd72e23f3f
Merge pull request #4207 from nicoddemus/recursive-dep-fixtures
...
Improve error message when a recursive dependency between fixtures is detected
2018-10-20 22:19:21 +05:30
Bruno Oliveira
7bb51b8ceb
Issue a warning when a fixture named 'request' is collected
...
Fix #611
2018-10-20 12:09:44 -03:00
Bruno Oliveira
b9990f77ff
Merge pull request #4204 from vbarbaresi/3340_log_hooks
...
Fix logging usage in hooks pytest_sessionstart/finish
2018-10-20 11:36:06 -03:00
Bruno Oliveira
02ae7d8531
Improve error message when a recursive dependency between fixtures is detected
...
Fix #2909
2018-10-20 09:44:42 -03:00
Bruno Oliveira
f947cb2613
Merge remote-tracking branch 'upstream/features' into davidszotten/stepwise
2018-10-20 09:18:02 -03:00
Vincent Barbaresi
db106d6085
Fix logging usage in hooks pytest_sessionstart/finish #3340
2018-10-20 09:55:10 +02:00
Bruno Oliveira
2abd005cc9
Merge pull request #4195 from nicoddemus/issue-3691
...
Use safe_str() to format warning message about unicode in Python 2
2018-10-19 07:18:29 -03:00
Anthony Sottile
dc0b4efffa
Merge pull request #4196 from nicoddemus/better-signature-error-msg-4026
...
Improve error message when it is not possible to determine a function's signature
2018-10-18 18:56:55 -07:00
Bruno Oliveira
18035211f5
Use safe_str() to format warning message about unicode in Python 2
...
Fix #3691
2018-10-18 21:56:17 -03:00
Anthony Sottile
61080da89d
Merge pull request #4192 from asottile/fix_recwarn_stacklevel
...
Fix filename reported by `warnings.warn` when using `recwarn` under python2.
2018-10-18 16:22:00 -07:00
Bruno Oliveira
ac5704290f
Improve error message when it is not possible to determine a function's signature
...
Fix #4026
2018-10-18 20:06:43 -03:00
Ankit Goel
1b51497936
[WIP] Update warning stacklevel when wrapping warnings.warn
2018-10-18 02:36:41 +00: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
ee0a306ee4
Merge remote-tracking branch 'upstream/features' into merge-features-into-master
2018-10-16 17:41:27 -03:00
Ankit Goel
f858177495
Merge pull request #4167 from vbarbaresi/3533_junit_escape_skipped
...
Fix #3533 : properly escape raw XML object
2018-10-16 21:10:42 +05:30
Bruno Oliveira
54b8ad4554
Merge pull request #4159 from thisch/subclassedfile
...
Increase required verbosity level for debug output
2018-10-16 10:41:27 -03:00
Vincent Barbaresi
f55ded20a9
fix #3533 : properly escape raw XML object
...
Using string formatting with the raw escaped object lead to string evaluation
"<py._xmlgen.raw object>"
Format the unescaped string first, then use the XML escape method as a last step.
2018-10-16 14:46:39 +02:00
David Szotten
c25310d34f
fix cacheprovider test
2018-10-15 21:51:15 +01:00
David Szotten
8187c148d9
now pinned to pytest version
2018-10-15 20:04:39 +01:00
David Szotten
e773c8ceda
linting
2018-10-15 20:04:39 +01:00
David Szotten
63c01d1541
update for builtin plugin
2018-10-15 20:04:39 +01:00
David Szotten
c56d7ac40e
move files into the pytest file structure
2018-10-15 20:04:39 +01:00
Thomas Hisch
e8c220b9bd
Increase required verbosity level for debug output
...
To show the subclassed file in legacy test suits in the runtest output
you have to set the verbosity level to at least "-vv" now.
Closes #3211
2018-10-15 20:38:32 +02:00
Bruno Oliveira
9646a1cd7a
Merge remote-tracking branch 'upstream/master' into merge-master-into-features
2018-10-15 12:55:28 -03:00
Ankit Goel
141c51f0cb
Merge pull request #4145 from labcodes/4098
...
Add returncode argument to pytest.exit
2018-10-15 11:04:11 +05:30
Bruno Oliveira
ced62f30ba
Attempt to create symlinks even on Windows, skipping when not possible
2018-10-14 18:21:04 -03:00
Jose Carlos Menezes
766d2daa06
Update returncode exit test to check exitstatus returrned from test session
2018-10-14 16:41:16 -03:00
Ronny Pfannschmidt
1dfa303b1e
fix #4135 - handle symlinks in tmp path cleanup
2018-10-14 21:20:34 +02:00
Bruno Oliveira
4808145846
test_request_garbage is flaky when running with xdist
...
Example failure:
https://travis-ci.org/pytest-dev/pytest/jobs/441305926#L545
2018-10-14 15:17:08 -03:00
Jose Carlos Menezes
ce55dcf64c
Add test for calling pytest.exit with statuscode
...
It checks that a SystemError was raised and the SystemError code
is the same as the returncode argument.
2018-10-14 12:29:19 -03:00
Bruno Oliveira
486ded3fca
Fix flaky durations test
...
Unfortunately due to fluctuations in runtime "test_something"
might still appear in the final message.
Example failure:
https://ci.appveyor.com/project/pytestbot/pytest/builds/19494829/job/8lx847u0c78m63wf
2018-10-14 12:22:56 -03:00
Daniel Hahler
d6832a8b56
Merge pull request #4133 from blueyed/pdb-quit
...
pdb: handle quitting in post_mortem
2018-10-14 11:29:09 +02:00
Daniel Hahler
3bfaa8ab84
Merge pull request #4132 from blueyed/pdb-internal-dupe
...
Do not print (duplicate) INTERNALERROR with --pdb.
2018-10-14 11:25:35 +02:00
Bruno Oliveira
9fb305b17b
Merge pull request #4086 from jeffreyrack/4063-exclude-0-durations
...
Exclude durations that are 0.00 seconds long.
2018-10-13 22:16:04 -03:00
Bruno Oliveira
e3bf9cede4
Fix linting
2018-10-13 22:13:25 -03:00
Daniel Hahler
86c7dcff68
pdb: handle quitting in post_mortem
...
`help quit` in pdb says:
> Quit from the debugger. The program being executed is aborted.
But pytest would continue with the next tests, often making it necessary
to kill the pytest process when using `--pdb` and trying to cancel the
tests using `KeyboardInterrupt` / `Ctrl-C`.
2018-10-14 00:05:45 +02:00
Daniel Hahler
7268462b33
Resolve symlinks for args
...
This fixes running `pytest tests/test_foo.py::test_bar`, where `tests`
is a symlink to `project/app/tests`: previously
`project/app/conftest.py` would be ignored for fixtures then.
2018-10-13 23:59:05 +02:00
Daniel Hahler
448830e656
Do not print INTERNALERROR with --pdb
...
This gets printed by the terminal reporter already, and currently
results in the same error being displayed twice, e.g. when raising an
`Exception` manually from `pytest.debugging.pytest_exception_interact`.
2018-10-13 23:56:34 +02:00
Bruno Oliveira
3683d92c53
Adjust the 'durations hidden' message
2018-10-13 18:40:32 -03:00
Daniel Hahler
d3d8d53e41
tests: test_pdb: fix print statements
2018-10-13 23:33:52 +02:00
Bruno Oliveira
24c83d725a
Merge pull request #4129 from nicoddemus/merge-master-into-features
...
Merge master into features (prepare for 3.9)
2018-10-13 12:05:54 -03:00
Daniel Hahler
6bf4692c7d
acceptance_test: clarify/document/fix tests
...
Ref: e2e6e31711 (r30863971)
2018-10-13 14:41:17 +02:00
Daniel Hahler
81426c3d19
tests: harden test_cmdline_python_package_symlink
2018-10-13 14:41:12 +02:00
Bruno Oliveira
29d5849519
Merge remote-tracking branch 'upstream/master' into merge-master-into-features
2018-10-13 08:50:32 -03:00
Bruno Oliveira
8e11fe5304
Improve tracebacks for ImportErrors in conftest.py files
...
Fix #3332
2018-10-12 10:10:55 -03:00
Bruno Oliveira
36dc671843
New ExceptionInfo.getrepr 'chain' parameter to be able to suppress chained exceptions
2018-10-12 10:08:55 -03:00
Bruno Oliveira
933de16fe4
Merge pull request #3988 from RonnyPfannschmidt/tmpdir-port-pathlib
...
Tmpdir port pathlib
2018-10-12 08:33:47 -03:00
Bruno Oliveira
e8348a1d12
Merge pull request #4077 from nicoddemus/short-usage-errors
...
Improve internal error messages
2018-10-12 08:18:07 -03:00
Bruno Oliveira
0f5263cdc3
Merge pull request #4109 from njonesu/master
...
Fix multiple string literals on a line #4093
2018-10-11 15:50:08 -03: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
2831cb9ab5
unify paths.py and pathlib.py
2018-10-11 07:15:09 +02:00
Ronny Pfannschmidt
00716177b4
fix missed Path import
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
c9a85b0e78
Fix linting
2018-10-10 19:54:39 -03:00
Bruno Oliveira
5436e42990
Use pytest.fail(..., pytrace=False) when treating user errors
...
This prevents an enormous and often useless stack trace from showing
to end users.
Fix #3867
Fix #2293
2018-10-10 19:16:53 -03:00
Daniel Hahler
be511c1a05
tests: add missing expect before sendeof for pdbpp
...
With pdb++ this additional `expect` is required, otherwise `sendeof()`
will block forever.
2018-10-10 20:50:49 +02:00
Daniel Hahler
f36f9d2698
tests: fix/clarify expect for Pdb
...
`expect()` expects an regular expression, so "Pdb" is equivalent to
"(Pdb)".
But instead of escaping the parenthesis this patch removes them, to
allow for matching "(Pdb++)", too.
2018-10-10 20:50:49 +02:00
Niklas JQ
c14a23d4e4
Fix #4093 : multiple string literals on a line
2018-10-10 19:28:31 +02:00
Anthony Sottile
e0f6fce9e9
In python2, display previously warned warnings
2018-10-10 09:37:21 -07:00
Anthony Sottile
aeb92accb2
Implement pytest.deprecated_call with pytest.warns
2018-10-10 08:03:23 -07:00
Bruno Oliveira
9a3836a0cf
Merge remote-tracking branch 'upstream/master' into merge-master-into-features
2018-10-09 19:34:04 -03:00
Ronny Pfannschmidt
8393fdd51d
Merge pull request #4089 from asottile/upgrade_hooks
...
Upgrade pre-commit hooks
2018-10-09 07:43:28 +02:00
Kyle Altendorf
4071c8a4a8
Correct timing in test_pytester.test_testdir_run_with_timeout()
2018-10-08 21:03:42 -04:00
Anthony Sottile
a86035625c
Increase recursion limit (broke xdist tests)
2018-10-08 12:57:45 -07:00
Anthony Sottile
4f631440be
Use RuntimeError for py27 + py34 compat
2018-10-08 11:47:06 -07:00
Anthony Sottile
3901569f26
Improve performance of ~3 of the slowest tests
2018-10-08 11:12:55 -07:00
Anthony Sottile
1caf6d5907
Upgrade pre-commit hooks
2018-10-08 10:10:46 -07:00
Jeffrey Rackauckas
fc11b81005
Exclude durations that are 0.00 seconds long.
2018-10-07 19:19:48 -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
Ronny Pfannschmidt
66609665f2
Merge pull request #4076 from nicoddemus/unittest-param-fixture-msg
...
Improve error message when TestCase functions use a parametrized fixture
2018-10-06 07:43:57 +02: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
Bruno Oliveira
a1208f5631
Merge pull request #4075 from nicoddemus/dynamic-fixturenames
...
Fix request.fixturenames to return fixtures created dynamically
2018-10-04 09:21:23 -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
212937eb3e
Improve error message when TestCase functions use a parametrized fixture
...
Fix #2535
2018-10-03 19:43:46 -03:00
Bruno Oliveira
70c7273640
Fix request.fixturenames to return fixtures created dynamically
...
Fix #3057
2018-10-03 18:50:14 -03:00
Anthony Sottile
b8b9e8d41c
Remove duplicate test (tested above)
2018-10-03 10:01:06 -07:00
Anthony Sottile
f102ccc8f0
Fix source reindenting by using `textwrap.dedent` directly.
2018-10-02 16:13:35 -07:00
Bruno Oliveira
1101a20408
Merge remote-tracking branch 'upstream/master' into merge-master-into-features
2018-10-02 18:13:54 -03:00
Bruno Oliveira
1a323fbd3c
Show a warning when non-str is given to Monkeypatch.setenv
2018-10-01 20:07:07 -03:00
Bruno Oliveira
bc009a8582
Fix test to comply with pypy 6.0
2018-10-01 18:37:27 -03:00
Bruno Oliveira
d24a7e6c5a
Issue warning if Monkeypatch.setenv/delenv receive non-strings in Python 2
...
Fixes the bug described in:
https://github.com/tox-dev/tox/pull/1025#discussion_r221273830
Which is more evident when using `unicode_literals`.
2018-10-01 17:05:30 -03:00
Ronny Pfannschmidt
5d2d64c190
Merge pull request #4057 from jeffreyrack/4051-improve-error-messaging
...
Improve error messaging when invalid syntax is passed to the -m option
2018-10-01 07:16:59 +02:00
Jeffrey Rackauckas
c2179c3127
Improve error messaging when invalid syntax is passed to the -m option
2018-09-30 18:34:56 -07:00
Bruno Oliveira
d8d7f73e1c
Merge pull request #4045 from nicoddemus/root-conftest-warning-workaround-4039
...
Do not issue non-top-level conftest warning when --pyargs is used
2018-09-27 09:26:11 -03:00
Bruno Oliveira
32c5a113e2
Do not issue non-top-level conftest warning when --pyargs is used
...
Fix #4039
2018-09-26 12:02:08 -03:00
Bruno Oliveira
ba5630e0f8
Simplify test_pytest_plugins_in_non_top_level_conftest_deprecated
2018-09-26 10:49:14 -03:00
Denis Otkidach
808df48ee8
Test for excluding empty reports for passed tests
2018-09-26 16:44:00 +03:00
Anthony Sottile
956b3aca97
Revert patching of breakpointhook as it appears to do nothing
2018-09-23 18:39:50 -07:00
iwanb
c61ff31ffa
Fix #3539 : reload module with assertion rewrite import hook
2018-09-23 13:05:55 +02:00
Ronny Pfannschmidt
e03a19f88d
Merge pull request #4021 from nicoddemus/merge-master-into-features
...
Merge master into features
2018-09-23 11:57:05 +02:00
Bruno Oliveira
56d0b5a7e2
Merge remote-tracking branch 'upstream/master' into merge-master-into-features
2018-09-22 18:14:36 -03:00
Bruno Oliveira
c30184709d
Show deprecation warnings even if filters are customized
...
Fix #4013
2018-09-22 10:25:57 -03:00
Ronny Pfannschmidt
f02dbaf97f
Merge pull request #4010 from nicoddemus/package-len-error-3749
...
Fix 'Package has no len()' error during collection
2018-09-21 07:40:20 +02:00
Bruno Oliveira
41f6ea13ce
Fix 'Package has no len()' error during collection
...
Fix #3749
2018-09-20 17:53:21 -03:00
Ronny Pfannschmidt
f6eb39df33
Merge pull request #4001 from asottile/fix_bytes_repr_text_mix_python_2
...
Fix UnicodeDecodeError in assertion with mixed non-ascii bytes repr + text
2018-09-20 22:16:37 +02:00
Anthony Sottile
7122fa5613
Fix UnicodeDecodeError in assertion with mixed non-ascii bytes repr + text
2018-09-19 20:24:00 -07:00
Bruno Oliveira
7aff81739e
Merge pull request #3998 from blueyed/logging-del
...
logging: del item.catch_log_handler only in teardown
2018-09-19 20:07:19 -03:00
Bruno Oliveira
27772f67c0
Merge pull request #3987 from nicoddemus/fix-find-scope-3941
...
Fix scope determination with indirect parameters
2018-09-19 20:06:45 -03:00
Daniel Hahler
e7eb7e799b
logging: del item.catch_log_handler only in teardown
...
Without this caplog.record_tuples etc is not available anymore when using
`--pdb`.
2018-09-19 17:17:47 +02:00
Thomas Hisch
048342817b
Add testcase for logging to file
2018-09-18 21:47:42 +02:00
Thomas Hisch
e967d4587a
Add support for logging in collection-phase
...
The logging plugin does not output log messages generated during the
collection-phase when live-logging is enabled. This fixes this.
Fixes #3964
2018-09-18 20:18:24 +02:00
Bruno Oliveira
a79dc12f1e
Merge pull request #3970 from sambarluc/raise_on_empty_parameterset
...
Raise exception if parametrize collects an empty parameter set
2018-09-18 08:11:34 -03:00
Bruno Oliveira
37d2469266
Use a PurePath instance to do matching against patterns in assertion rewrite
...
This way we don't need to have real file system path, which prevents the
original #3973 bug.
2018-09-17 20:29:09 -03:00
Bruno Oliveira
1df6d28080
Fix assertion rewriter crash if cwd changes mid-testing
...
Unfortunately we need to get a `py.path.local` object to perform the fnmatch
operation, it is different from the standard `fnmatch` module because it
implements its own custom logic. So we need to use `py.path` to perform
the fnmatch for backward compatibility reasons.
Ideally we should be able to use a "pure path" in `pathlib` terms (a path
not bound to the file system), but we don't have those in pylib.
Fix #3973
2018-09-17 20:04:44 -03:00
Andrea Cimatoribus
05155e4db0
Fail at parametrize option for empty parameter set
...
Optionally raise an exception when parametrize collects no arguments.
Provide the name of the test causing the failure in the exception
message.
See: #3849
2018-09-15 09:18:03 +02:00
Bruno Oliveira
86a14d007d
Fix scope determination with indirect parameters
...
Fix #3941
2018-09-14 21:33:59 -03:00
Bruno Oliveira
87ddb2dbd5
Change flaky test_request_garbage to provide more debug information
...
This test fails *very* rarely when running in xdist.
2018-09-14 15:25:45 -03:00
Bruno Oliveira
9aa6b0903b
.pytest_cache is now automatically ignored by Git
2018-09-14 15:16:40 -03:00
Bruno Oliveira
feb8240410
Use self.Function again during collection
2018-09-13 15:44:02 -03:00
Bruno Oliveira
b7dd9154c3
Deprecate custom node types during collection by using special names
2018-09-13 14:55:28 -03:00
Bruno Oliveira
482bd5efd2
Show deprecation warning for cached_setup
2018-09-13 14:25:46 -03:00