Commit Graph

12368 Commits

Author SHA1 Message Date
Bruno Oliveira 4d439760ad
Merge pull request #7168 from nicoddemus/saferepr-getattr-fail-7145 2020-05-06 17:57:38 -03:00
Bruno Oliveira 199f45d0a9
Merge pull request #7027 from blueyed/doc-rm-rm 2020-05-06 12:43:51 -03:00
Ran Benita d16ae0bbdc
Merge pull request #7171 from bluetech/code-import-cycles
code: fix import cycles between code.py and source.py
2020-05-06 18:15:32 +03:00
Ran Benita 8c2c297e1e
Merge pull request #7172 from bluetech/micro-optimizations-1
Some easy micro optimizations to collection
2020-05-06 18:13:44 +03:00
Ran Benita 89eee90b5f python: optimize PythonCollector.collect 2020-05-06 12:05:04 +03:00
Ran Benita b90f34569f nodes: micro-optimize Node attribute access 2020-05-06 11:58:30 +03:00
Ran Benita 5702c86f4c nodes: micro-optimize hash(node)
Turns out it's called alot, and saving the function call makes it
faster.
2020-05-06 11:58:30 +03:00
Ran Benita fcc473ab1c Use dict instead of OrderedDict on Python 3.7
OrderedDict is quite a bit heavier than just a dict.
2020-05-06 11:58:28 +03:00
Ran Benita 69143fe5b0 code: fix import cycles between code.py and source.py
These two files were really intertwined. Make it so code.py depends on
source.py without a reverse dependency.

No functional changes.
2020-05-06 11:01:32 +03:00
Bruno Oliveira d0022b5a13 'saferepr' handles classes with broken __getattribute__
Fix #7145
2020-05-05 19:22:39 -03:00
Ran Benita 4787fd64a4
Merge pull request #7167 from bluetech/lint-merge-fix
testing: fix lint after merge of old branch
2020-05-05 23:34:05 +03:00
Ran Benita 94400a68b4 terminal: fix non-deterministic warning summary order in Python 3.5
In Python 3.5, collections.Counter() does not preserve insertion order.
2020-05-05 23:08:44 +03:00
Ran Benita abf785666a testing: fix lint after merge of old branch 2020-05-05 22:00:55 +03:00
Ran Benita 4b91617002
Merge pull request #7020 from blueyed/fix-warnings-summary
Fix warnings summary
2020-05-05 21:58:57 +03:00
Ran Benita a8dbb32a6b
Merge pull request #6797 from blueyed/tests-simpler
tests: simplify test_pytest_plugins_in_non_top_level_conftest_…
2020-05-05 21:51:50 +03:00
Ran Benita b4be6cd4b7
Merge pull request #6765 from blueyed/capture-refactor-1
Refactor Capture classes: move/rename CaptureIO classes
2020-05-05 21:46:18 +03:00
Daniel Hahler 8cae78a18b Fix warnings summary
- replace "tests with warnings" with just warnings: they a) might not
  come from a test in the first place, and b) a single test might have
  multiple warnings.
- fix usage of (unused) argument to `collapsed_location_report`

Co-authored-by: Ran Benita <ran@unusedvar.com>
2020-05-05 21:40:34 +03:00
Ran Benita d7d627b1e8
Merge pull request #7064 from blueyed/fix-_printcollecteditems-doc-upstream
Fix/improve printing of docs for collected items
2020-05-05 21:31:21 +03:00
Daniel Hahler 7647d1c836 Move Capture classes from compat to capture and improve naming
Move {Passthrough,CaptureIO} to capture module, and rename Passthrough
-> Tee to match the existing terminology.

Co-authored-by: Ran Benita <ran@unusedvar.com>
2020-05-05 21:24:59 +03:00
Ran Benita 46d768503e
Merge pull request #6839 from blueyed/typing-get_dirs_from_args-parseconfig
typing: get_dirs_from_args, parseconfig
2020-05-05 21:11:26 +03:00
Ran Benita 85732e2b08
Merge pull request #6993 from blueyed/doc-pytest_collection-upstream
[WIP] doc: pytest_collection: has to set `session.items`
2020-05-05 21:05:56 +03:00
Ran Benita b4c46da278
Merge pull request #7029 from blueyed/fix-test_popen_default_stdin_stderr_and_stdin_None-upstream
Fix `test_popen_default_stdin_stderr_and_stdin_None` when run with `-s`
2020-05-05 21:03:04 +03:00
Bruno Oliveira 16a44823eb Use reportinfo() instead of location in skipping message 2020-05-04 19:50:40 -03:00
Katarzyna 9b423710aa Remove unnecessary file in test. 2020-05-04 00:34:19 +02:00
Katarzyna a5bcd0655f Test relapth when rootdir != invocationdir. 2020-05-04 00:04:38 +02:00
Katarzyna 402ee6fb9d Relative path to invocationdir instead rootdir. 2020-05-03 22:56:38 +02:00
Bruno Oliveira 80e5098408
Merge pull request #7155 from kerizane/make_numbered_dir 2020-05-03 09:48:36 -03:00
Keri Volans 678440e46d 7018: Use internal version of make_numbered_dir 2020-05-03 10:45:06 +01:00
Bruno Oliveira 6dcfc93d45
Merge pull request #7157 from nicoddemus/remove-blueyed-tidelift 2020-05-02 22:05:55 -03:00
Bruno Oliveira 799dab5284 Remove blueyed from TIDELIFT
blueyed is no longer a member of the pytest-dev organization.
2020-05-02 21:56:52 -03:00
Bruno Oliveira 3312820051
Merge pull request #7151 from nicoddemus/unittest-cleanup-6947 2020-05-02 15:43:54 -03:00
Bruno Oliveira 82f584b5a9 Fix test_trial_error in test_unittest
This reverts the test to the state before 04f27d4, which introduced the breaking
change about addCleanup not being called properly for failed tests.
2020-05-02 15:26:55 -03:00
Bruno Oliveira 5c2e96c0e6 Fix cleanup functions not being invoked on test failures
Also delay calling tearDown() when --pdb is given, so users still have
access to the instance variables (which are usually cleaned up during tearDown())
when debugging.

Fix #6947
2020-05-02 15:26:55 -03:00
Bruno Oliveira 2b51ed46d5
Merge pull request #7153 from nicoddemus/xunit-warning-update 2020-05-02 13:31:34 -03:00
Bruno Oliveira 095a195d71 Improve docs about junit_family warning message
From discussion in #6178
2020-05-02 13:01:15 -03:00
Bruno Oliveira 0b78983197
Merge pull request #7141 from bluetech/rm-nonzero 2020-05-02 10:00:35 -03:00
Bruno Oliveira 5afa8717db
Merge pull request #7147 from nicoddemus/doc-typos 2020-05-01 17:36:29 -03:00
Bruno Oliveira e3643751bc
Merge pull request #7144 from nicoddemus/async-testcase-7110 2020-05-01 16:44:10 -03:00
Bruno Oliveira fd2f172258 Let unittest frameworks deal with async functions
Instead of trying to handle unittest-async functions in pytest_pyfunc_call,
let the unittest framework handle them instead.

This lets us remove the hack in pytest_pyfunc_call, with the upside that
we should support any unittest-async based framework.

Also included 'asynctest' as test dependency for py37-twisted, and renamed
'twisted' to 'unittestextras' to better reflect that we install 'twisted' and
'asynctest' now.

This also fixes the problem of cleanUp functions not being properly called
for async functions.

Fix #7110
Fix #6924
2020-05-01 15:10:28 -03:00
Bruno Oliveira 5c37898949 Fix some typos in the CHANGELOG 2020-05-01 14:39:09 -03:00
Bruno Oliveira d0fe6e01c8
Merge pull request #7143 from nicoddemus/file-from-parent 2020-05-01 13:07:40 -03:00
Bruno Oliveira 7f5978c34c Allow File.from_parent to forward custom parameters to the constructor 2020-05-01 11:00:52 -03:00
Ran Benita a718ad6363 Stop using Python's eval() for -m and -k
Previously, the expressions given to the `-m` and `-k` options were
evaluated with `eval`. This causes a few issues:

- Python keywords cannot be used.

- Constants like numbers, None, True, False are not handled correctly.

- Various syntax like numeric operators and `X if Y else Z` is supported
  unintentionally.

- `eval()` is somewhat dangerous for arbitrary input.

- Can fail in many ways so requires `except Exception`.

The format we want to support is quite simple, so change to a custom
parser. This fixes the issues above, and gives us full control of the
format, so can be documented comprehensively and even be extended in the
future if we wish.
2020-05-01 12:59:06 +03:00
Ran Benita 409ffcef17 Remove a couple Python 2 __nonzero__ definitions
It's called __bool__ in Python 3.
2020-05-01 11:41:21 +03:00
Ran Benita e40bf1d1da Add a changelog for TerminalWriter changes 2020-04-30 16:44:03 +03:00
Ran Benita d8558e87c5 terminalwriter: clean up markup function a bit 2020-04-30 16:44:03 +03:00
Ran Benita 414a87a53f config/argparsing: use our own get_terminal_width() 2020-04-30 16:44:03 +03:00
Ran Benita bafc9bd58b testing: merge code/test_terminal_writer.py into io/test_terminalwriter.py 2020-04-30 16:44:03 +03:00
Ran Benita 0e36596268 testing/io: port TerminalWriter tests from py 2020-04-30 16:44:03 +03:00
Ran Benita d5584c7207 terminalwriter: compute width_of_current_line lazily
Currently this property is computed eagerly, which means
get_line_width() is computed on everything written, but that is a slow
function.

Compute it lazily, so that get_line_width() only runs when needed.
2020-04-30 16:44:03 +03:00