Skip to content

Node from parent - #5975

Merged
nicoddemus merged 2 commits into
pytest-dev:featuresfrom
RonnyPfannschmidt:node-from-parent
Nov 23, 2019
Merged

nicoddemus merged 2 commits into
pytest-dev:featuresfrom
RonnyPfannschmidt:node-from-parent

Conversation

@RonnyPfannschmidt

Copy link
Copy Markdown
Member

this pr experiments with introducing a Node.from_parent api that is to replace the smart constructors eventually

it will take a while manifest this experiment

@RonnyPfannschmidt
RonnyPfannschmidt changed the base branch from master to features October 16, 2019 19:53
Comment thread src/_pytest/python.py Resolved
Comment thread src/_pytest/nodes.py Resolved
@RonnyPfannschmidt RonnyPfannschmidt changed the title [WIP] [POC] Node from parent [POC] Node from parent Oct 28, 2019
@RonnyPfannschmidt

Copy link
Copy Markdown
Member Author

this is now in a shape where critical examination is needed and merge after history clean/detail fixes

@RonnyPfannschmidt

Copy link
Copy Markdown
Member Author

scrap that, i realized that i want to ensure the arguments are severely limited in order to prepare the switchover

@RonnyPfannschmidt RonnyPfannschmidt changed the title [POC] Node from parent [WIP][POC] Node from parent Oct 28, 2019
Comment thread src/_pytest/nodes.py
@classmethod
def from_parent(cls, parent, **kw):
return cls._create(**kw, parent=parent)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the benefit compared to making parent a required argument in general? (would avoid a lot of changes at least)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i need to establish a distinct construction pattern in order to then follow up with cleaning up the node construction (thats overly smart and auto-creating different things)

i tried a few times before without that and just failed flat on those occasions

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok.
But maybe then we could just revert it to "normal" object instantiation afterwards? (i.e. before merging, not requiring all the warnings etc).

I think raising TypeErrors and using type annotations in general could be enough?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as soon as the ctor situation is largely resolved and the pattern is established, the meta class can go

Comment thread src/_pytest/nodes.py Resolved
Comment thread src/_pytest/nodes.py Resolved
Comment thread src/_pytest/unittest.py Resolved

@nicoddemus nicoddemus left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall this looks great!

Other than that, please also add an entry to deprecations.rst with a .. deprecated:: directive, and more importantly, a longer rationale of the reasons why this is being deprecated.

Comment thread src/_pytest/nodes.py Resolved
Comment thread changelog/5975.deprecation.rst Resolved
Comment thread testing/test_mark.py Resolved
Comment thread testing/test_nodes.py Resolved
@RonnyPfannschmidt

Copy link
Copy Markdown
Member Author

i believe im done with the technical part now, will take a look at doing docs over the weekend

Comment thread changelog/5975.deprecation.rst Resolved
@RonnyPfannschmidt
RonnyPfannschmidt force-pushed the node-from-parent branch 2 times, most recently from 88a0e82 to 43b5c30 Compare November 22, 2019 23:07
@RonnyPfannschmidt RonnyPfannschmidt changed the title [WIP][POC] Node from parent Node from parent [DONT MERGE; BUT CHECK] Nov 23, 2019
@RonnyPfannschmidt RonnyPfannschmidt changed the title Node from parent [DONT MERGE; BUT CHECK] Node from parent Nov 23, 2019
@nicoddemus
nicoddemus merged commit a3c8246 into pytest-dev:features Nov 23, 2019
blueyed added a commit to blueyed/pytest that referenced this pull request Feb 24, 2020
This reverts commit a3c8246, reversing
changes made to 886b8d2.

Ref: pytest-dev#5975 (comment)

Conflicts:
	src/_pytest/main.py
	src/_pytest/unittest.py

Squashed:

7c4b8a0  Revert "Node from parent (pytest-dev#5975)"
89abdb9  keep test, warning
c9062ed  warn via NodeMeta
149bddb  keep/adjust testing/test_mark.py:1013::test_addmarker_order
de91222  tests: handle DefinitionMock
9e3b17f  fix testing/test_collection.py:453::TestSession::test_parsearg

Conflicts:

    both modified:   src/_pytest/nodes.py
    both modified:   src/_pytest/python.py
twmr added a commit to twmr/pytest-sphinx that referenced this pull request Apr 1, 2020
The Node API was changed in pytest 5.4 in
pytest-dev/pytest#5975.

This commit adds support for the new API but maintains backwards
compatiblity.

Closes: #11
twmr added a commit to twmr/pytest-sphinx that referenced this pull request Apr 1, 2020
The Node API was changed in pytest 5.4 in
pytest-dev/pytest#5975.

This commit adds support for the new API but maintains backwards
compatiblity.

Closes: #11
twmr added a commit to twmr/pytest-sphinx that referenced this pull request Apr 1, 2020
The Node API was changed in pytest 5.4 in
pytest-dev/pytest#5975.

This commit adds support for the new API but maintains backwards
compatiblity.

Closes: #11
twmr added a commit to twmr/pytest-sphinx that referenced this pull request Apr 1, 2020
The Node API was changed in pytest 5.4 in
pytest-dev/pytest#5975.

This commit adds support for the new API but maintains backwards
compatiblity.

Closes: #11
@karenfeng karenfeng mentioned this pull request Aug 20, 2020
2 of 3 tasks
blueyed added a commit to blueyed/pytest that referenced this pull request Sep 1, 2020
Keeps `Node.from_parent` for backward compatibility.

This reverts commit a3c8246, reversing
changes made to 886b8d2.

Ref: pytest-dev#5975 (comment)
blueyed added a commit to blueyed/pytest that referenced this pull request Sep 2, 2020
blueyed added a commit to blueyed/pytest that referenced this pull request Sep 2, 2020
blueyed added a commit to blueyed/pytest that referenced this pull request Sep 16, 2020
Keeps `Node.from_parent` for backward compatibility.

This reverts commit a3c8246, reversing
changes made to 886b8d2.

Ref: pytest-dev#5975 (comment)
blueyed added a commit to blueyed/pytest that referenced this pull request Sep 16, 2020
blueyed added a commit to blueyed/pytest that referenced this pull request Sep 16, 2020
blueyed added a commit to blueyed/pytest that referenced this pull request Oct 15, 2020
Keeps `Node.from_parent` for backward compatibility.

This reverts commit a3c8246, reversing
changes made to 886b8d2.

Ref: pytest-dev#5975 (comment)
blueyed added a commit to blueyed/pytest that referenced this pull request Oct 26, 2020
Keeps `Node.from_parent` for backward compatibility.

This reverts commit a3c8246, reversing
changes made to 886b8d2.

Ref: pytest-dev#5975 (comment)
blueyed added a commit to blueyed/pytest that referenced this pull request Nov 5, 2020
Keeps `Node.from_parent` for backward compatibility.

This reverts commit a3c8246, reversing
changes made to 886b8d2.

Ref: pytest-dev#5975 (comment)
blueyed added a commit to blueyed/pytest that referenced this pull request Nov 5, 2020
Keeps `Node.from_parent` for backward compatibility.

This reverts commit a3c8246, reversing
changes made to 886b8d2.

Ref: pytest-dev#5975 (comment)
blueyed added a commit to blueyed/pytest that referenced this pull request Nov 5, 2020
bors Bot referenced this pull request in aragilar/spaceplot Apr 17, 2021