Commit Graph

2663 Commits

Author SHA1 Message Date
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
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
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