Commit Graph

11942 Commits

Author SHA1 Message Date
Ran Benita dd5c2b22bd Refactor Session._initialparts to have a more explicit type
Previously, _initialparts was a list whose first item was a
`py.path.local` and the rest were `str`s. This is not something that
mypy is capable of modeling. The type `List[Union[str, py.path.local]]`
is too broad and would require asserts for every access.

Instead, make each item a `Tuple[py.path.local, List[str]]`. This way
the structure is clear and the types are accurate.

To make sure any users who might have been accessing this (private)
field will not break silently, change the name to _initial_parts.
2020-01-25 13:57:49 +02:00
Daniel Hahler a29d6194f5 ci: codecov: only use "comment: off"
The changes status is quite buggy, remove it for now.
This just uses "comment: off" then.
2020-01-25 11:14:00 +01:00
Daniel Hahler 6f2943c7b3
Merge pull request #6558 from gavento/patch-1
Make EncodedFile.write() return the return value from inner write()
2020-01-25 11:04:12 +01:00
Tomáš Gavenčiak 5e15c86cc6 Fix EncodedFile.write return value
Make EncodedFile, used for captured output streams, method .write return
the number of characters written. Add test for captured stderr write.
Fixes #6557.

Co-Authored-By: Bruno Oliveira <nicoddemus@gmail.com>
2020-01-25 10:36:23 +01:00
Daniel Hahler 498884a2a0
Merge pull request #6563 from blueyed/merge-master-into-features
Merge master into features
2020-01-25 00:31:58 +01:00
Daniel Hahler 09bdbffbde Merge master into features
Conflicts:
	src/_pytest/_code/code.py
	src/_pytest/main.py
2020-01-24 23:44:50 +01:00
Daniel Hahler 09ab5fd7e9
Merge pull request #6529 from blueyed/fix-test_repr_traceback_with_invalid_cwd
tests: fix test_repr_traceback_with_invalid_cwd
2020-01-24 23:41:31 +01:00
Daniel Hahler 040a61e22c
Merge pull request #6550 from blueyed/doc-cleandir-cd-back
doc/en/fixture.rst: chdir back to previous directory
2020-01-24 23:41:08 +01:00
Daniel Hahler 2c32dad343
Merge pull request #6554 from blueyed/test_fixture_arg_ordering
tests: add test_fixture_arg_ordering
2020-01-24 23:40:58 +01:00
Daniel Hahler 8a8f9bd751
Merge pull request #6562 from blueyed/ci-rm-azure
ci: remove Azure config/scripts
2020-01-24 23:39:57 +01:00
Daniel Hahler 192d3adda3 tests: add test_fixture_arg_ordering
This is a regression test for part of
https://github.com/pytest-dev/pytest/issues/6492, testing one of the
fixes in https://github.com/pytest-dev/pytest/pull/6551.
2020-01-24 17:48:08 -03:00
Daniel Hahler 5865520c51
Merge pull request #6561 from blueyed/ci-gha-name-flag
ci: GHA: codecov: set CODECOV_NAME, OS in flags
2020-01-24 20:04:12 +01:00
Daniel Hahler e2fa78c99f ci: remove Azure config/scripts
This is covered by GitHub Actions now.
2020-01-24 19:49:57 +01:00
Daniel Hahler fe895a40b6
Merge pull request #6559 from blueyed/ci-travis-remove-linting
ci: Travis: removing linting,docs,doctesting
2020-01-24 19:45:42 +01:00
Daniel Hahler 934f38995a ci: GHA: codecov: set CODECOV_NAME, OS in flags 2020-01-24 19:42:51 +01:00
Daniel Hahler 5dcd24fecb
Merge pull request #6553 from blueyed/ci-gha-use-report-coverage.sh
ci: GHA: use scripts/report-coverage.sh
2020-01-24 19:20:23 +01:00
Daniel Hahler e5a362d0f5 ci: GHA: use scripts/report-coverage.sh 2020-01-24 18:00:38 +01:00
Daniel Hahler f8654e6656 ci: Travis: removing linting,docs,doctesting
This is handled by GHA already, and not affected/required for coverage.
2020-01-24 17:26:10 +01:00
Daniel Hahler 0d4f479aa8
Merge pull request #6552 from blueyed/ci-linting
ci: GHA: separate jobs for linting, docs, doctesting
2020-01-24 13:36:59 +01:00
Daniel Hahler 79d00ab35a
Merge pull request #6549 from blueyed/fix-release-minor
doc: minor fixes for the release process
2020-01-24 13:36:48 +01:00
Daniel Hahler 79ae86cc3f tests: fix test_repr_traceback_with_invalid_cwd
This never worked as expected (since a912d3745), and only py38-windows
triggered the mocked `os.getcwd` unintentionally, via `inspect`.
2020-01-24 12:52:12 +01:00
Daniel Hahler c051a9e7b9 ci: GHA: separate jobs for linting, docs, doctesting
It helps to know upfront that e.g. linting failed, and makes finding the
error easier.
2020-01-24 12:29:35 +01:00
Daniel Hahler cdd6f86e43 bug-fix fixes 2020-01-23 20:34:21 +01:00
Daniel Hahler 83451b548f doc/en/fixture.rst: chdir back to previous directory
This is considered to be best practice, and should be used in docs
therefore.
2020-01-23 19:09:18 +01:00
Daniel Hahler 38538c6c6d
Merge pull request #6548 from blueyed/ci-codecov-flag-gha
ci: codecov: add flag for GHA
2020-01-23 18:39:50 +01:00
Daniel Hahler 55ebd9f803 doc: minor fixes for the release process 2020-01-23 18:31:48 +01:00
Daniel Hahler 8ca8d25202
Merge pull request #6545 from blueyed/terminalwriter
config: typing for create_terminal_writer, re-export TerminalWriter
2020-01-23 15:42:18 +01:00
Daniel Hahler a8d67f5e7b ci: codecov: add flags for GHA/Travis
This would help with debugging missing coverage when removing Travis
jobs.
2020-01-23 15:41:41 +01:00
Daniel Hahler 03bc8aba4e config: typing for create_terminal_writer, re-export TerminalWriter
This also imports `TerminalWriter` explicitly via `_pytest._io`,
allowing for easier extending / replacing it.
2020-01-23 14:09:37 +01:00
Daniel Hahler 6b13379f37
Merge pull request #6521 from blueyed/harden-nose-raises
tests: improve test for `nose.raises`
2020-01-23 13:42:14 +01:00
Ran Benita 9dcdea5de7 Rewrite Item.location to be clearer with regard to types 2020-01-23 13:25:15 +01:00
Daniel Hahler 863bab5326
Merge pull request #6544 from blueyed/doc-rm-costlysetup
doc: remove costlysetup example
2020-01-23 13:21:32 +01:00
Daniel Hahler 8521503246
Merge pull request #6527 from blueyed/typing-getfslineno
typing: fix/adjust _code.source.getfslineno
2020-01-23 13:17:47 +01:00
Ran Benita 0b6258ab5b PyCollector.collect: use explicit cast to `str`
Ref: https://github.com/pytest-dev/pytest/pull/6521#pullrequestreview-347234792
2020-01-23 12:54:52 +01:00
Daniel Hahler b63cb18776 doc: remove costlysetup example
It is not included with docs, and
`example/costlysetup/sub_a/test_quick.py::test_quick` sleeps for 5s,
slowing down `doctesting` unnecessarily.
2020-01-23 12:23:30 +01:00
Daniel Hahler 00097df5cd tests: add test_plugin_loading_order
Ref: https://github.com/pytest-dev/pytest/pull/6443
2020-01-23 11:57:12 +01:00
Daniel Hahler 10e243d206
Merge pull request #6543 from blueyed/rm-rw
tests: remove unnecessary `-rw` option
2020-01-23 11:56:07 +01:00
Daniel Hahler e7444bbd5e tests: remove unnecessary `-rw` option
Warnings are enabled by default, which is tested by `test_getreportopt`.
2020-01-23 11:37:19 +01:00
Daniel Hahler eb7a57f965
Merge pull request #6542 from blueyed/fix-test_record_property
tests: fix/harden test_record_property
2020-01-23 11:14:37 +01:00
Daniel Hahler 252eae5bc8 tests: fix/harden test_record_property
`-rv` is not a recognized reportchar.  Probably `-v` was meant, but is
not necessary to check that there are no warnings.

Followup to 2018cf12b (https://github.com/pytest-dev/pytest/pull/3360).
2020-01-23 10:49:59 +01:00
Daniel Hahler 9c7b3c57d7 typing: PyobjMixin.reportinfo, getfslineno 2020-01-23 10:45:31 +01:00
Daniel Hahler 1350c601dc Node.location: handle str with _node_location_to_relpath 2020-01-23 10:45:31 +01:00
Daniel Hahler ef112fd7dd Revert "Revert "Fix type errors after adding types to the `py` dependency""
Without changes to test_itemreport_reportinfo.

This reverts commit fb99b5c66e.

Conflicts:
	testing/test_nose.py
2020-01-23 10:45:27 +01:00
Daniel Hahler 8fa57c8384 tests: improve test for `nose.raises`
This should probably get transferred into a `pytest.fail` really, but
tests/documents the current behavior.
2020-01-23 10:45:26 +01:00
Daniel Hahler ad02f6f879
Merge pull request #6525 from blueyed/typing-session
typing: Session.__init__
2020-01-23 00:16:08 +01:00
Daniel Hahler bd6ba3f3e1 typing: Session.__init__
Pulled out of https://github.com/pytest-dev/pytest/pull/6491.
2020-01-23 00:07:59 +01:00
Bruno Oliveira e17f5fad14
Clear node collection cache after collection is done (#6491)
Clear node collection cache after collection is done
2020-01-22 16:08:59 -03:00
Daniel Hahler 72d06e6dec
Merge pull request #6539 from blueyed/merge-master-into-features
Merge master into features
2020-01-22 19:32:49 +01:00
Daniel Hahler aca1723d45 Merge master into features 2020-01-22 19:18:13 +01:00
Daniel Hahler 85df6bbe26
Merge pull request #6536 from blueyed/fix-test_cwd_snapshot
tests: fix test_cwd_snapshot
2020-01-22 16:46:04 +01:00