Bruno Oliveira
f987b368e8
Merge pull request #3776 from alysivji/attrs-n-dataclasses
...
Detailed assert failure introspection for attrs and dataclasses objects
2018-11-22 21:25:35 -02:00
Bruno Oliveira
9ae8429a21
Use a more specific exception type in test_raises_repr_inflight
...
As requested during review
2018-11-22 20:24:46 -02:00
Ronny Pfannschmidt
88bf01a31e
fix #4386 - restructure construction and partial state of ExceptionInfo
2018-11-22 21:20:32 +01:00
Ronny Pfannschmidt
abaf496fe8
Merge pull request #4440 from nicoddemus/config-warning-stacklevel
...
Adjust stacklevel of "config" warnings
2018-11-22 21:02:52 +01:00
Ronny Pfannschmidt
b71bd9b300
fix #4386 - handle uninitialized exceptioninfo in repr/str
2018-11-22 20:52:15 +01:00
Ronny Pfannschmidt
94d032a6de
Merge pull request #4436 from asottile/print_function
...
Fix formatting of print() calls
2018-11-22 20:17:19 +01:00
Bruno Oliveira
aa765cf8c2
Adjust stacklevel of "config" warnings
...
Related to #4439
2018-11-22 14:44:01 -02: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
Anthony Sottile
b3700f61ba
Fix formatting of print() calls
2018-11-22 00:15:14 -08:00
Ronny Pfannschmidt
fc61bdd907
fix 4425: resolve --basetemp to absolute paths
2018-11-20 16:14:50 +01:00
Anthony Sottile
95c6d591f7
Properly escape \r \n \t bytes
2018-11-19 11:03:52 -08:00
Anthony Sottile
9ca0ab6e2b
Ensure printable manually-specified param(id=...)
2018-11-19 11:03:52 -08:00
Anthony Sottile
8395b9e25d
Require id=... to be a string
...
This was documented before, but never enforced. Passing non-strings could
have strange side-effects and enforcing a string simplifies other
implementation.
2018-11-19 11:03:52 -08:00
Anthony Sottile
3d92d5a659
Make sure parametrize ids are printable
2018-11-19 11:03:52 -08:00
Anthony Sottile
50e3783f07
Merge pull request #4421 from RonnyPfannschmidt/remove-pytest-namespace
...
remove pytest namespace hook
2018-11-19 09:35:33 -08:00
Ronny Pfannschmidt
ba17363d75
remove pytest namespace hook
2018-11-19 14:04:41 +01:00
Daniel Hahler
92a2884b09
pdb: support kwargs with `pdb.set_trace`
...
This handles `header` similar to Python 3.7 does it, and forwards any
other keyword arguments to the Pdb constructor.
This allows for `__import__("pdb").set_trace(skip=["foo.*"])`.
Fixes https://github.com/pytest-dev/pytest/issues/4416 .
2018-11-19 13:04:14 +01: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