Minuddin Ahmed Rana
ef437ea448
Remove incorrect choices comment ( #6677 )
2020-02-05 20:45:21 +01:00
Daniel Hahler
cdc7e13067
pytester: clarify _makefile signature ( #6675 )
2020-02-05 20:42:57 +01:00
Daniel Hahler
632800add5
internal: clean up getfslineno ( #6656 )
2020-02-04 22:46:00 +01:00
Daniel Hahler
aa0328782f
assertion: save/restore hooks on item ( #6646 )
2020-02-04 02:56:23 +01:00
Daniel Hahler
9c7f1d9b32
Remove compat.getfslineno
2020-02-04 02:40:59 +01:00
Daniel Hahler
dab90ef726
typing: fix getfslineno
...
Closes https://github.com/pytest-dev/pytest/pull/6590 .
2020-02-03 19:09:08 +01:00
Daniel Hahler
61f2a26675
Code/getfslineno: keep empty co_filename
...
Previously this would be turned via `py.path.local("")` into the current
working directory.
This appears to be what `fspath = fn and py.path.local(fn) or None`
tries to avoid in `getfslineno`'s `TypeError` handling already, if
`Code` would raise it.
2020-02-03 19:09:08 +01:00
Daniel Hahler
b0d45267c5
internal: clean up getfslineno
...
Everything was using `_pytest.compat.getfslineno` basically, which
wrapped `_pytest._code.source.getfslineno`.
This moves the extra code from there into it directly, and uses the
latter everywhere.
This helps to eventually remove the one in compat eventually, and also
causes less cyclic imports.
2020-02-03 19:09:08 +01:00
Daniel Hahler
a9c5d31806
PyCollector._genfunctions: use already created fixtureinfo ( #6636 )
...
`Function` creates a `_fixtureinfo` already:
https://github.com/pytest-dev/pytest/blob/fed535694/src/_pytest/python.py#L1392-L1395
2020-02-01 06:27:41 +01:00
Daniel Hahler
1dc265e34a
Merge pull request #6633 from blueyed/async_warn
...
python: factor out async_warn
2020-01-30 23:39:06 +01:00
Daniel Hahler
e7a833635d
Merge pull request #6635 from blueyed/fix-todo
...
minor: doc: getfuncargnames: move TODO out of docstring
2020-01-30 23:37:41 +01:00
Daniel Hahler
fed5356941
Merge pull request #6634 from blueyed/fixtures-move-import
...
fixtures: move import of ParameterSet to top level
2020-01-30 23:22:39 +01:00
Daniel Hahler
5b81bd862c
minor: doc: getfuncargnames: move TODO out of docstring
2020-01-30 23:22:10 +01:00
Daniel Hahler
2902c7263c
fixtures: move import of ParameterSet to top level
...
This gets typically used always (via `getfixtureinfo`).
2020-01-30 23:03:02 +01:00
Daniel Hahler
442dccef65
python: factor out async_warn
2020-01-30 22:55:23 +01:00
Daniel Hahler
88b800355a
typing: pytest_collection
2020-01-30 19:58:43 +01:00
Daniel Hahler
28b8f3ca3a
Merge pull request #6461 from blueyed/test-package-upstream
...
Package: typing, cleanup
2020-01-30 16:41:47 +01:00
Bruno Oliveira
d282424589
Fix unguarded `==` comparison in fixtures. ( #6541 )
...
Fix unguarded `==` comparison in fixtures.
2020-01-28 20:54:14 -03:00
Daniel Hahler
4ff90b1fcf
Merge pull request #6606 from blueyed/typing-monkeypatch-context
...
typing: MonkeyPatch.context
2020-01-29 00:12:53 +01:00
Holger Kohr
80d4dd6f0b
Replace `==` with `is` for comparison of cache keys
...
Closes #6497
2020-01-28 18:05:53 -03:00
Daniel Hahler
e25d46aae6
typing: MonkeyPatch.context
2020-01-28 21:44:30 +01:00
Daniel Hahler
7c87874277
source_path: py.path.local directly
...
Via bc7282576
.
2020-01-28 19:02:41 +01:00
Daniel Hahler
1cf9e68dbc
tests: cover absolute path handling in _compute_fixture_value
2020-01-28 18:53:28 +01:00
Daniel Hahler
18ac7e0b79
Merge pull request #6593 from blueyed/typing-ignore-more-itertools
...
typing: ignore false positive with more-itertools
2020-01-28 14:24:24 +01:00
Daniel Hahler
12c5a6af64
typing: fix Code.path
...
Fixes:
> src/_pytest/_code/code.py:83: error: Incompatible types in assignment
> (expression has type "str", variable has type "local") [assignment]
2020-01-28 01:49:45 +01:00
Daniel Hahler
35ba053f00
typing: ignore false positive with more-itertools
...
Fixed in https://github.com/erikrose/more-itertools/pull/374 .
2020-01-28 01:23:44 +01:00
Daniel Hahler
9c716e4d74
typing: Testdir.plugins
2020-01-28 00:41:46 +01:00
Daniel Hahler
94ac0f7e6b
typing: self._mod_collections, collect_by_name
2020-01-28 00:41:46 +01:00
Daniel Hahler
440881d63a
typing: Testdir.__init__
2020-01-28 00:41:46 +01:00
Ran Benita
ae5d16be10
typing: FSHookProxy/gethookproxy
...
Taken out of https://github.com/pytest-dev/pytest/pull/6556 .
2020-01-27 20:57:44 +01:00
Daniel Hahler
bf5c76359c
fixup! typing: tests: tmpfile
2020-01-26 23:14:32 +01:00
Daniel Hahler
3f8f395210
typing: EncodedFile
2020-01-25 19:20:48 +01:00
Daniel Hahler
e2934c3f8c
Move common code between Session and Package to FSCollector
2020-01-25 19:04:01 +01:00
Daniel Hahler
6b7e1a246c
Sync `{Session,Package}.gethookproxy`
...
Only copy'n'paste error from c416b1d935
.
2020-01-25 19:04:01 +01:00
Daniel Hahler
817c094ce6
Clean up Package.__init__
...
Makes `parent` a required arg, which would have failed before via
`parent.session` anyway.
Keeps calling/passing unused args for B/C.
2020-01-25 19:04:01 +01:00
Daniel Hahler
039d582b52
Fix `EncodedFile.writelines`
...
This is implemented by the underlying stream already, which additionally
checks if the stream is not closed, and calls `write` per line.
Ref/via: https://github.com/pytest-dev/pytest/pull/6558#issuecomment-578210807
2020-01-25 18:06:50 +01:00
Daniel Hahler
9b8039cf09
Sync `{Session,Package}._recurse`
2020-01-25 16:44:20 +01:00
Ran Benita
94d8c071b6
Remove a couple of redundant commas
...
Mypy complains about this once the function is typed:
src/_pytest/main.py:85: error: "_addoption" of "OptionGroup" does not return a value
src/_pytest/main.py:133: error: "addoption" of "OptionGroup" does not return a value
2020-01-25 14:12:47 +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
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
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
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
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
Daniel Hahler
b8787b8732
tests: fix test_cwd_snapshot
...
Without restoring the cwd, successive tests might fail to parse the
config (via `_pytest.config._prepareconfig()`, for when `--lsof` is
used).
And it is good practice to restore the cwd in any case anyway.
2020-01-22 14:34:11 +01:00