Gleb Nikonorov
92d15c6af1
review feedback
2020-05-31 11:33:31 -04:00
Gleb Nikonorov
db203afba3
Add in --strict-config flag to force warnings to errors
2020-05-31 02:45:40 -04:00
Gleb Nikonorov
8f2c2a5dd9
Add test case for invalid ini key in different section header
2020-05-31 00:49:21 -04:00
Gleb Nikonorov
eef4f87e7b
Output a warning to stderr when an invalid key is read from an INI config file
2020-05-30 20:36:02 -04:00
Bruno Oliveira
56bf819c2f
Do not call TestCase.tearDown for skipped tests ( #7236 )
...
Fix #7215
2020-05-30 14:33:22 -03:00
Katarzyna Król
94c7b8b47c
Issue 1316 - longrepr is a string when pytrace=False ( #7100 )
2020-05-30 14:10:58 +03:00
Ran Benita
e3190604ef
Merge pull request #7274 from bluetech/rm-py-error
...
code: remove last usage of py.error
2020-05-28 13:10:46 +03:00
Ran Benita
2ee90887b7
code: remove last usage of py.error
...
`str(self.path)` can't raise at all, so it can just be removed.
2020-05-28 12:12:10 +03:00
Anthony Sottile
b3db440d4c
Merge pull request #7257 from DahlitzFlorian/fix-issue-6956
...
Prevent pytest from printing ConftestImportFailure traceback
2020-05-27 13:49:43 -07:00
Ran Benita
54b6fe2ece
Merge pull request #7261 from bluetech/capture-cleanup-1
...
capture: some initial cleanups
2020-05-27 18:14:01 +03:00
Ran Benita
f93e021bc8
capture: remove some unclear parametrization from a test
...
The two cases end up doing the same (the tmpfile fixture isn't used
except being truthy).
2020-05-27 15:27:16 +03:00
Ran Benita
7a704288df
capture: remove unneeded getattr
...
This attribute is set in __init__ and not deleted. Other methods do it
already but this one wasn't updated.
2020-05-27 15:27:16 +03:00
Ran Benita
a35800c2e1
capture: formalize and check allowed state transition in capture classes
...
There are state transitions start/done/suspend/resume and two additional
operations snap/writeorg.
Previously it was not well defined in what order they can be called, and
which operations are idempotent.
Formalize this and enforce using assert checks with informative error
messages if they fail (rather than random AttributeErrors).
2020-05-27 15:27:15 +03:00
Ran Benita
fd3ba053cf
capture: don't assume that the tmpfile is backed by a BytesIO
...
Since tmpfile is a parameter to SysCapture, it shouldn't assume things
unnecessarily, when there is an alternative.
2020-05-27 15:19:30 +03:00
Ran Benita
97bcf5a3a2
capture: reorder file into sections and avoid forward references
...
Make it easier to read the file in progression, and avoid forward
references for upcoming type annotations.
There is one cycle, CaptureManager <-> CaptureFixture, which is hard to
untangle.
(This commit should be added to `.gitblameignore`).
2020-05-27 15:19:28 +03:00
Florian Dahlitz
5b9924e144
Fix py35 CI run
2020-05-27 09:27:13 +02:00
Florian Dahlitz
95bd232e57
Apply suggestions from @bluetech
2020-05-26 10:31:53 +02:00
Ran Benita
ea3f44894f
capture: replace TeeSysCapture with SysCapture(tee=True)
...
This is more straightforward and does not require duplicating the
initialization logic.
2020-05-26 00:25:49 +03:00
Ran Benita
02c95ea624
capture: remove unused FDCapture tmpfile argument
2020-05-26 00:25:49 +03:00
Ran Benita
2695b41df3
capture: inline _capturing_for_request to simplify the control flow
...
With straight code, it is a little easier to understand, and simplify
further.
2020-05-26 00:25:49 +03:00
Ran Benita
491239d9b2
capture: remove some indirection in MultiCapture
...
Removing this indirection enables some further clean ups.
2020-05-26 00:25:49 +03:00
Florian Dahlitz
5ebcb34fb5
Move ConftestImportFailure check to correct position and add typing
2020-05-25 20:19:28 +02:00
Ronny Pfannschmidt
54ae27f081
Merge pull request #7252 from symonk/6900-class-per-instance-of-test-docs
...
document class instantiation for tests inside classes
2020-05-25 19:58:23 +02:00
Florian Dahlitz
6546d1f725
Prevent pytest from printing ConftestImportFailure traceback
2020-05-25 13:57:03 +02:00
symonk
5061a47de8
add missing test text to docs
2020-05-24 16:33:17 +01:00
symonk
4f93bc01af
update terminology of class individuality as per PR feedback
2020-05-24 16:31:51 +01:00
symonk
568e00af15
fixing up formatting inline with a smaller shell and typos
2020-05-24 11:43:29 +01:00
symonk
bad7a0207f
document new class instance per test
2020-05-24 11:34:54 +01:00
Anthony Sottile
981b096940
Merge pull request #7249 from asottile/deadsnakes_github_action
...
Use deadsnakes/action@v1.0.0 to install python3.9 nightly
2020-05-23 20:09:52 -07:00
Anthony Sottile
c9abdaf381
Use deadsnakes/action@v1.0.0 to install python3.9 nightly
2020-05-23 19:51:51 -07:00
Anthony Sottile
c594bbbd19
Merge pull request #7240 from DahlitzFlorian/fix-issue-7233
...
Add note about --strict and --strict-markers to references
2020-05-23 12:31:27 -07:00
Anthony Sottile
45f53266e6
Merge pull request #7244 from DahlitzFlorian/fix-issue-7150
...
Prevent hiding underlying exception when ConfTestImportFailure is raised
2020-05-23 12:09:42 -07:00
Florian Dahlitz
35e6dd0117
Add test for exposure of underlying exception
2020-05-23 18:19:33 +02:00
Claire Cecil
79701c65ed
Added support for less verbose version information ( #7169 )
2020-05-23 11:27:58 -03:00
Simon K
05c22ff823
7154-Improve-testdir-documentation-on-makefiles ( #7239 )
2020-05-23 11:27:06 -03:00
Ran Benita
b38edec60f
Merge pull request #7238 from bluetech/micro-optimizations-1
...
A few tiny micro-optimizations/simplifications
2020-05-23 12:14:24 +03:00
Florian Dahlitz
d0eb86cfa6
Prevent hiding underlying exception when ConfTestImportFailure is raised
2020-05-22 22:58:35 +02:00
Florian Dahlitz
62d3577435
Add note about --strict and --strict-markers to references
2020-05-22 16:33:50 +02:00
Ran Benita
4a1557fa0e
Merge pull request #7091 from bluetech/capture-invalid-fd
...
Perform FD capturing even if the FD is invalid
2020-05-22 14:36:49 +03:00
Ran Benita
f1f9c7792b
Import `packaging` package lazily
2020-05-22 14:33:29 +03:00
Ran Benita
796fba6788
terminal: remove redundant write_fspath_result call
...
This is already done in pytest_runtest_logstart, so the fspath is
already guaranteed to have been printed (for xdist, it is disabled
anyway).
write_fspath_result is mildly expensive so it is worth avoiding calling
it twice.
2020-05-22 14:33:29 +03:00
Ran Benita
139a029b5e
terminal: remove a redundant line
...
`write_fspath_result` already does this split.
2020-05-22 14:33:29 +03:00
Ran Benita
8d841ab0b8
nodes: remove unused argument from FSHookProxy
2020-05-22 14:33:28 +03:00
Ran Benita
919ac2239d
Merge pull request #7231 from bluetech/logging-error
...
logging: propagate errors during log message emits
2020-05-22 14:27:26 +03:00
Bruno Oliveira
c98bc4cd3d
Merge pull request #7234 from mcsitter/master
2020-05-20 17:51:06 -03:00
mcsitter
fa6a13a7cc
Updated compatible python versions
...
As indicated on pypi and in the README pytest supports python version 3.8 and 3.9. The documentation should match.
2020-05-20 22:41:52 +02:00
Ran Benita
1af3c115a6
Merge pull request #7200 from bluetech/contributing-backporting
...
CONTRIBUTING: add section about backporting fixes to patch releases
2020-05-20 20:21:23 +03:00
Ran Benita
eaeafd7c30
Perform FD capturing even if the FD is invalid
...
The `FDCapture`/`FDCaptureBinary` classes, used by `capfd`/`capfdbinary`
fixtures and the `--capture=fd` option (set by default), redirect FDs
1/2 (stdout/stderr) to a temporary file. To do this, they need to save
the old file by duplicating the FD before redirecting it, to be restored
once finished.
Previously, if this duplicating (`os.dup()`) failed, most likely due to
that FD being invalid, the FD redirection would silently not be done. The
FD capturing also performs python-level redirection (monkeypatching
`sys.stdout`/`sys.stderr`) which would still be done, but direct writes
to the FDs would fail.
This is not great. If pytest is run with `--capture=fd`, or a test is
using `capfd`, it expects writes to the FD to work and be captured,
regardless of external circumstances.
So, instead of disabling FD capturing, keep the redirection to a
temporary file, just don't restore it after closing, because there is
nothing to restore to.
2020-05-20 19:32:37 +03:00
Ran Benita
b337a9a66d
CONTRIBUTING: add section about backporting fixes to patch releases
2020-05-20 19:29:13 +03:00
Bruno Oliveira
0a03217903
Merge pull request #7046 from blueyed/k-skip-session-upstream
2020-05-19 20:09:36 -03:00