Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-59022: add tests to extend_path#12871

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed
Windsooon wants to merge6 commits intopython:mainfromWindsooon:bpo-14817

Conversation

@Windsooon
Copy link
Contributor

@WindsooonWindsooon commentedApr 18, 2019
edited by bedevere-bot
Loading

Actually, there are some tests for extend_path already (seehttps://github.com/python/cpython/blob/master/Lib/test/test_pkgutil.py#L235). I add some tests for it anyway. However, I didn't test every line of the code in the extend_path function.

https://bugs.python.org/issue14817

@nanjekyejoannah
Copy link
Contributor

cc@ericvsmith

@arhadthedevarhadthedev changed the titlebpo-14817: add tests to extend_pathgh-59022: add tests to extend_pathFeb 5, 2023
@arhadthedev
Copy link
Member

Would anybody mind to review and possibly merge this PR?

furkanonder reacted with thumbs up emoji

@arhadthedev
Copy link
Member

@vsajip,@brettcannon, could you review and possibly merge this PR, please? (as the ones who committed intoLib/test/test_pkgutil.py more than once last ten years and still active)

furkanonder and auvipy reacted with thumbs up emoji

@brettcannon
Copy link
Member

I'm rather swamped right now, so it might be a while (especially since I want to deprecate the entirepkgutil module eventually 😁).

@brettcannonbrettcannon self-requested a reviewApril 12, 2023 18:31
Copy link
Member

@brettcannonbrettcannon left a comment

Choose a reason for hiding this comment

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

The tests have some misleading names and they are not cleaning up after themselves appropriately.


classExtendPathBaseTests(unittest.TestCase):
deftest_input_type_invalid(self):
# path should be list instead of string
Copy link
Member

Choose a reason for hiding this comment

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

Comments should be complete sentences.

name='foo'
self.assertEqual('path',pkgutil.extend_path(path,name))

deftest_parent_package_raise_key_error(self):
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
deftest_parent_package_raise_key_error(self):
deftest_parent_package_raises_key_error(self):

Copy link
Member

Choose a reason for hiding this comment

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

There's nothing here making sureKeyError is raised, so the name of the test is confusing.

name='foo.bar'
self.assertEqual(['path'],pkgutil.extend_path(path,name))

deftest_parent_package_raise_attr_error(self):
Copy link
Member

Choose a reason for hiding this comment

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

The name doesn't match what seems to be tested.


deftest_extend_path_files(self):
# create foo/bar.py
self.dirname=tempfile.mkdtemp()
Copy link
Member

Choose a reason for hiding this comment

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

There's no cleanup of the temporary directory.

Comment on lines +518 to +519
f=open(os.path.join(package_path,'bar.py'),"w")
f.close()
Copy link
Member

Choose a reason for hiding this comment

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

Use a context manager and write a comment in the file as to the purpose of the file existing.

f=open(os.path.join(package_path,'bar.py'),"w")
f.close()
# Search valid or invalid module
importfoo
Copy link
Member

Choose a reason for hiding this comment

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

This will leavesys.modules dirty from this test. Use the helper functions intest.support to make sure this method cleans up after itself.

@bedevere-bot
Copy link

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phraseI have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

@erlend-aaslanderlend-aasland added the pendingThe issue will be closed if no feedback is provided labelFeb 9, 2024
@nineteendo
Copy link
Contributor

Do we close this or do we remove the pending label? It's been almost 100 days.

@ericvsmith
Copy link
Member

Closing due to inactivity.

@AA-TurnerAA-Turner removed the pendingThe issue will be closed if no feedback is provided labelApr 6, 2025
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@brettcannonbrettcannonbrettcannon requested changes

@furkanonderfurkanonderfurkanonder approved these changes

+1 more reviewer

@auvipyauvipyauvipy approved these changes

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Labels

awaiting changesskip newstestsTests in the Lib/test dir

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

14 participants

@Windsooon@nanjekyejoannah@arhadthedev@brettcannon@bedevere-bot@nineteendo@ericvsmith@auvipy@furkanonder@taleinat@AA-Turner@erlend-aasland@the-knights-who-say-ni@ezio-melotti

[8]ページ先頭

©2009-2025 Movatter.jp