Commit Graph

12649 Commits

Author SHA1 Message Date
Anthony Sottile e75531791d
Merge pull request #7315 from bluetech/rm-__multicall__
testing: change a test to not use deprecated pluggy __multicall__ protocol
2020-06-03 12:31:35 -07:00
Ran Benita 2e219ad4f3 testing: change a test to not use deprecated pluggy __multicall__ protocol
It is slated to be removed in pluggy 1.0.
2020-06-03 21:51:55 +03:00
Bruno Oliveira 61a6ac9705
Merge pull request #7242 from nicoddemus/fix-flaky-test
Introduce _pytest.timing as a way to control timing during internal tests
2020-06-02 20:25:02 -03:00
Anthony Sottile 5814f77455
Merge pull request #7303 from nicoddemus/flaky-ini-keys
Show invalid ini keys sorted
2020-06-02 12:30:33 -07:00
Anthony Sottile 8cca023840 cache the pre-commit environment 2020-06-02 12:30:10 -07:00
Bruno Oliveira 8ac18bbecb Show invalid ini keys sorted
Otherwise this relies on the dictionary order of `config.inicfg`, which
is insertion order in py36+ but "random" order in py35.
2020-06-02 16:01:47 -03:00
Bruno Oliveira 69d2ddcf1d
Merge pull request #7302 from nicoddemus/cherry-pick-release
Merge pull request #7301 from pytest-dev/release-5.4.3
2020-06-02 14:36:01 -03:00
Bruno Oliveira be1a2e440e Merge pull request #7301 from pytest-dev/release-5.4.3
Prepare release 5.4.3
2020-06-02 14:19:18 -03:00
Ran Benita 85b5a289f0
warnings: fix missing None in existing hook & add some docs (#7288) 2020-06-02 19:59:25 +03:00
Bruno Oliveira 7a8b8a5c9f
Merge branch 'master' into fix-flaky-test 2020-06-02 11:33:15 -03:00
Bruno Oliveira da5851c13e
Update changelog/7291.trivial.rst 2020-06-02 11:01:37 -03:00
Ronny Pfannschmidt 8faf1e8eca
Merge pull request #7286 from gnikonorov/issue_6856
Output a warning to stderr when an invalid key is read from an INI config file
2020-06-02 15:47:02 +02:00
xuiqzy 5517f7264f
Remove doc line that is no longer relevant for Python3-only (#7263)
* Fix typo in capture.rst documentation

Rename ``capfsysbinary`` to ``capsysbinary`` as the former does not exist as far as i can see.

* Make Python uppercase in doc/en/capture.rst

Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>

* Remove the sentence entirely

Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
Co-authored-by: Ran Benita <ran@unusedvar.com>
2020-06-02 15:56:39 +03:00
Gleb Nikonorov a5d13d4ced Add changelog entry 2020-06-02 08:21:57 -04:00
Bruno Oliveira 589c6c6acc
Merge pull request #7294 from nicoddemus/codecov-adjustments 2020-06-02 09:02:05 -03:00
Tor Colvin fe64093411
Fix removal of very long paths on Windows (#6755)
Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
2020-06-02 08:56:33 -03:00
Bruno Oliveira eaf46f5354 Adjust codecov: only patch statuses
Fix #6994
2020-06-02 08:17:43 -03:00
Ran Benita 9214e63af3
ci: use fetch-depth: 0 instead of fetching manually (#7297) 2020-06-02 10:29:36 +03:00
Keri Volans 2748feed38 7291: Replace py.iniconfig with iniconfig 2020-06-01 18:09:57 +01:00
Bruno Oliveira 2f406bb9cb
Replace custom flask theme by the official one (#6453)
Ref: #6402
2020-06-01 14:21:08 +02:00
Gleb Nikonorov 9ae94b08e2 Add documentation 2020-05-31 11:58:39 -04:00
Bruno Oliveira 70b5bdf4ba
Merge pull request #7264 from bluetech/wcwidth
Improve our own wcwidth implementation and remove dependency on wcwidth package
2020-05-31 12:37:58 -03:00
Gleb Nikonorov 92d15c6af1 review feedback 2020-05-31 11:33:31 -04:00
Simon K 9da1d0687e
adding towncrier wrapper script so 'tox -e docs' works natively on windows (#7266)
* enable tox -e docs natively on windows using a wrapper

* rename the towncrier script; run the towncrier command in a safer manner

* use subprocess.call; call exit() around main on towncrier wrapper

* change to sys.exit() instead of builtin exit()
2020-05-31 12:11:11 -03:00
Ronny Pfannschmidt c16ede5ce6
Merge pull request #7255 from gnikonorov/issue_4049
Add new hook pytest_warning_recorded
2020-05-31 12:47:46 +02:00
Gleb Nikonorov db203afba3 Add in --strict-config flag to force warnings to errors 2020-05-31 02:45:40 -04:00
Maximilian Cosmo Sitter b32f4de891
Issue 7202 - Point development guide to contributing section (#7280) 2020-05-31 09:37:26 +03: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 a146559008
Merge pull request #7220 from nicoddemus/issue-6428 2020-05-30 20:14:26 -03:00
Bruno Oliveira 757bded135 Use Path() instead of str for path comparison
On Windows specifically is common to have drives diverging just by
casing ("C:" vs "c:"), depending on the cwd provided by the user.
2020-05-30 20:05:21 -03:00
Bruno Oliveira b98aa195e0 Add test and changelog for #6428 2020-05-30 20:02:47 -03:00
Daniel Hahler fb9f277a99 Node._repr_failure_py: use abspath with changed cwd
Fixes https://github.com/pytest-dev/pytest/issues/6428.
2020-05-30 20:02:47 -03: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
Gleb Nikonorov 2af0d1e221 remove a stray comma in a test tuple 2020-05-28 00:02:28 -04:00
Gleb Nikonorov 14de08011b fix the unit tests, add the proper deprecation warning, and add in a changelog entry 2020-05-27 23:03:07 -04: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
Gleb Nikonorov d742b386c3 provide missing location parameter, and add type annotations to the hookspec 2020-05-27 00:53:31 -04:00
Ran Benita aca534c67d Improve our own wcwidth implementation and remove dependency on wcwidth package
`TerminalWriter`, imported recently from `py`, contains its own
incomplete wcwidth (`char_with`/`get_line_width`) implementation. The
`TerminalReporter` also needs this, but uses the external `wcwidth`
package.

This commit brings the `TerminalWriter` implementation up-to-par with
`wcwidth`, moves to implementation to a new file `_pytest._io.wcwidth`
which is used everywhere, and removes the dependency.

The differences compared to the `wcwidth` package are:

- Normalizes the string before counting.

- Uses Python's `unicodedata` instead of vendored Unicode tables. This
  means the data corresponds to the Python's version Unicode version
  instead of the `wcwidth`'s package version.

- Apply some optimizations.
2020-05-26 17:14:01 +03:00
Ran Benita 5507752c53 fixtures: remove special cases when deciding when pytest.fixture() is a direct decoration
pytest.fixture() can be used either as

    @pytest.fixture
    def func(): ...

or as

    @pytest.fixture()
    def func(): ...

or (while maybe not intended)

    func = pytest.fixture(func)

so it needs to inspect internally whether it got a function in the first
positional argument or not.

Previously, there were was oddity. In the following,

    func = pytest.fixture(func, autouse=True)
    # OR
    func = pytest.fixture(func, parms=['a', 'b'])

The result is as if `func` wasn't passed.

There isn't any reason for this special that I can understand, so remove
it.
2020-05-26 11:48:40 +03:00