summaryrefslogtreecommitdiff
path: root/src/_pytest/nodes.py
AgeCommit message (Collapse)Author
2020-12-30[pre-commit.ci] pre-commit autoupdate (#8201)pre-commit-ci[bot]
* [pre-commit.ci] pre-commit autoupdate * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * manual fixes after configuration update * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Anthony Sottile <asottile@umich.edu>
2020-12-26nodes: avoid needing to expose NodeKeywords for typingRan Benita
It adds no value over exporting just the ABC so do that to reduce the API surface.
2020-12-22code: convert from py.path to pathlibRan Benita
2020-12-18address commentsantonblr
2020-12-18tests: Migrate to pytester - final updateantonblr
2020-12-15Some py.path.local -> pathlib.PathRan Benita
2020-12-12Some py.path.local -> pathlib.PathRan Benita
- Some conftest related functions - _confcutdir - Allow arbitrary os.PathLike[str] in gethookproxy.
2020-11-21permit node to warn with any warning type, not just PytestWarning (#8052)Simon K
Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
2020-10-25fixtures: use a faster replacement for ischildnodeRan Benita
ischildnode can be quite hot in some cases involving many fixtures. However it is always used in a way that the nodeid is constant and the baseid is iterated. So we can save work by pre-computing the parents of the nodeid and use a simple containment test. The `_getautousenames` function has the same stuff open-coded, so change it to use the new function as well.
2020-10-05py36+: com2annAnthony Sottile
2020-10-04nodes: remove cyclic dependency on _pytest.fixturesRan Benita
- Change the fixtures plugin to store its one piece of data on the node's Store instead of directly. - Import FixtureLookupError lazily.
2020-10-03py36+: remove rexport of Path and PurePathAnthony Sottile
2020-10-03py36+: remove _pytest.compat.overloadAnthony Sottile
2020-10-02py36+: from typing import Type: no longer need guardAnthony Sottile
2020-10-02py36+: remove TYPE_CHECKING from _pytest.compatAnthony Sottile
automated with: ```bash git grep -l 'from .* import TYPE_CHECKING' | xargs reorder-python-imports \ --application-directories .:src \ --remove-import 'from _pytest.compat import TYPE_CHECKING' \ --add-import 'from typing import TYPE_CHECKING' ```
2020-09-04Replace some usages of config.{rootdir,inifile} with config.{rootpath,inipath}Ran Benita
2020-08-28Add missing File reference to the docsBruno Oliveira
As related in #7696
2020-08-24Revert "Move common code between Session and Package to FSCollector"Ran Benita
This reverts commit f10ab021e21a44e2f0fa2be66660c4a6d4b7a61a. The commit was good in that it removed a non-trivial amount of code duplication. However it was done in the wrong layer (nodes.py) and split up a major part of the collection (the filesystem traversal) to a separate class making it harder to understand. We should try to reduce the duplication, but in a more appropriate manner.
2020-08-19Remove broken pytest_collect_directory hookBruno Oliveira
2020-08-19Hard failure when constructing Node subclassesBruno Oliveira
2020-08-15Only define gethookproxy, isinitpath on SessionRan Benita
This fixes an issue where pylint complains about missing implementations of abstract methods in subclasses of `File` which only override `collect()` (as they should). It is also cleaner and makes sense, these methods really don't need to be overridden. The previous methods defined directly on `FSCollector` and `Package` are deprecated, to be removed in pytest 7. See commits e2934c3f8c03c83469f4c6670c207773a6e02df4 and f10ab021e21a44e2f0fa2be66660c4a6d4b7a61a for reference.
2020-08-14Don't use NotImplementedError in `@overload`sRan Benita
We used it as a shortcut for avoiding coverage, but pylint has a special interpretation of it as an abstract method which we don't want.
2020-08-01typing: set disallow_any_genericsRan Benita
This prevents referring to a generic type without filling in its generic type parameters. The FixtureDef typing might need some more refining in the future.
2020-08-01Format docstrings in a consistent styleRan Benita
2020-07-25pathlib: make visit() independent of py.path.local, use os.scandirRan Benita
`os.scandir()`, introduced in Python 3.5, is much faster than `os.listdir()`. See https://www.python.org/dev/peps/pep-0471/. It also has a `DirEntry` which can be used to further reduce syscalls in some cases.
2020-07-10Remove no longer needed `noqa: F821` usesRan Benita
Not needed since pyflakes 2.2.0.
2020-06-22nodes: fix string possibly stored in Node.keywords instead of MarkDecoratorRan Benita
This mistake was introduced in 7259c453d6c1dba6727cd328e6db5635ccf5821c.
2020-06-13Introduce --import-mode=importlib (#7246)Bruno Oliveira
Fix #5821 Co-authored-by: Ran Benita <ran@unusedvar.com>
2020-06-12Fix some type errors around py.path.localRan Benita
These errors are found using a typed version of py.path.local.
2020-06-05Improve types around repr_failure()Ran Benita
2020-06-05Enable check_untyped_defs mypy option for src/Ran Benita
This option checks even functions which are not annotated. It's a good step to ensure that existing type annotation are correct. In a Pareto fashion, the last few holdouts are always the ugliest, beware.
2020-06-05Type annotate _pytest.junitxmlRan Benita
2020-06-05Type annotate more of _pytest.nodesRan Benita
2020-06-05Type annotate main.py and some parts related to collectionRan Benita
2020-06-05Type annotate some hookspecs & implsRan Benita
Annotate some "easy" arguments of hooks that repeat in a lot of internal plugins. Not all of the arguments are annotated fully for now.
2020-06-05Type annotate some misc places with no particular connectionRan Benita
2020-05-30Use Path() instead of str for path comparisonBruno Oliveira
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-30Node._repr_failure_py: use abspath with changed cwdDaniel Hahler
Fixes https://github.com/pytest-dev/pytest/issues/6428.
2020-05-30Issue 1316 - longrepr is a string when pytrace=False (#7100)Katarzyna Król
2020-05-26Apply suggestions from @bluetechFlorian Dahlitz
2020-05-25Move ConftestImportFailure check to correct position and add typingFlorian Dahlitz
2020-05-25Prevent pytest from printing ConftestImportFailure tracebackFlorian Dahlitz
2020-05-22nodes: remove unused argument from FSHookProxyRan Benita
2020-05-12Remove no longer needed noqa'sRan Benita
2020-05-06Merge pull request #7171 from bluetech/code-import-cyclesRan Benita
code: fix import cycles between code.py and source.py
2020-05-06nodes: micro-optimize Node attribute accessRan Benita
2020-05-06nodes: micro-optimize hash(node)Ran Benita
Turns out it's called alot, and saving the function call makes it faster.
2020-05-06code: fix import cycles between code.py and source.pyRan Benita
These two files were really intertwined. Make it so code.py depends on source.py without a reverse dependency. No functional changes.
2020-05-01Allow File.from_parent to forward custom parameters to the constructorBruno Oliveira
2020-04-12Squash: Resolved 2nd round of review commentsAndreas Maier