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

Remove@NoEffect annotations#1677

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

Merged
Byron merged 1 commit intogitpython-developers:mainfromEliahKagan:no-noeffect
Sep 22, 2023
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletionstest/test_docs.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -167,7 +167,7 @@ def update(self, op_code, cur_count, max_count=None, message=""):
open(new_file_path, "wb").close() # create new file in working tree
cloned_repo.index.add([new_file_path]) # add it to the index
# Commit the changes to deviate masters history
cloned_repo.index.commit("Added a new file in the past - for latermerege")
cloned_repo.index.commit("Added a new file in the past - for latermerge")

# prepare a merge
master = cloned_repo.heads.master # right-hand side is ahead of us, in the future
Expand DownExpand Up@@ -198,7 +198,7 @@ def update(self, op_code, cur_count, max_count=None, message=""):

# .gitmodules was written and added to the index, which is now being committed
cloned_repo.index.commit("Added submodule")
assert sm.exists() and sm.module_exists() # this submodule isdefintely available
assert sm.exists() and sm.module_exists() # this submodule isdefinitely available
sm.remove(module=True, configuration=False) # remove the working tree
assert sm.exists() and not sm.module_exists() # the submodule itself is still available

Expand DownExpand Up@@ -263,9 +263,9 @@ def test_references_and_objects(self, rw_dir):
# [8-test_references_and_objects]
hc = repo.head.commit
hct = hc.tree
hc != hct # noqa: B015 # @NoEffect
hc != repo.tags[0] # noqa: B015 # @NoEffect
hc == repo.head.reference.commit # noqa: B015 # @NoEffect
asserthc != hct
asserthc != repo.tags[0]
asserthc == repo.head.reference.commit
# ![8-test_references_and_objects]

# [9-test_references_and_objects]
Expand Down
4 changes: 2 additions & 2 deletionstest/test_refs.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -386,7 +386,7 @@ def test_head_reset(self, rw_repo):
head_tree = head.commit.tree
self.assertRaises(ValueError, setattr, head, "commit", head_tree)
assert head.commit == old_commit # and the ref did not change
# we allowheds to point to any object
# we allowheads to point to any object
head.object = head_tree
assert head.object == head_tree
# cannot query tree as commit
Expand DownExpand Up@@ -489,7 +489,7 @@ def test_head_reset(self, rw_repo):
cur_head.reference.commit,
)
# it works if the new ref points to the same reference
assert SymbolicReference.create(rw_repo, symref.path, symref.reference).path == symref.path # @NoEffect
assert SymbolicReference.create(rw_repo, symref.path, symref.reference).path == symref.path
SymbolicReference.delete(rw_repo, symref)
# would raise if the symref wouldn't have been deletedpbl
symref = SymbolicReference.create(rw_repo, symref_path, cur_head.reference)
Expand Down
2 changes: 1 addition & 1 deletiontest/test_submodule.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -111,7 +111,7 @@ def _do_base_tests(self, rwrepo):

# force it to reread its information
del smold._url
smold.url == sm.url # noqa: B015 #@NoEffect
smold.url == sm.url # noqa: B015 #FIXME: Should this be an assertion?
Copy link
Member

Choose a reason for hiding this comment

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

If made into an assertion it would fail, I wonder if this means that there is a bug in the submodule implementation or the assertion is simply wrong to begin with. Maybe it's an assertion that doesn't work similarly on all platforms?

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

I'm not fully clear on what is expected to happen. In context, we have:

# some commits earlier we still have a submodule, but its at a different commit
smold=next(Submodule.iter_items(rwrepo,self.k_subm_changed))
assertsmold.binsha!=sm.binsha
assertsmold!=sm# the name changed
# force it to reread its information
delsmold._url
smold.url==sm.url# noqa: B015 # FIXME: Should this be an assertion?

When it is made into an assertion,pytest shows:

E       AssertionError: assert 'git://gitorious.org/git-python/gitdb.git' == 'https://github.com/gitpython-developers/gitdb.git'E         - https://github.com/gitpython-developers/gitdb.gitE         + git://gitorious.org/git-python/gitdb.gittest/test_submodule.py:114: AssertionError

Is the different remote URL part of what this intends to test? Or is this something that broke at some point (or would have broken, if it were an assertion) as a result of moving the remote to GitHub?

Copy link
Member

Choose a reason for hiding this comment

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

It's surprising to see a gitorious URL there - where would that be coming from?

When looking at this confused, I'd think it's definitely not suitable as tutorial of any kind. Maybe it's better to either revamp it into something more useful, or remove it entirely.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

I don't think this was part of the tutorial. In this PR, I removed@NoEffect everywhere in the tests, not just in lines of code that are included in the generated documentation. (This occurrence was in the submodule tests.)

Copy link
Member

Choose a reason for hiding this comment

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

Oh, thanks for the clarification, I should have known by looking at the filename in the provided code excerpt.

Since it's already a FIXME, I presume that when trying to improve the GitPython package layout and maybe make submodule tests independent of their containing repository, this will naturally be resolved.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

I think making the tests independent would entail fixing it. Whether or not improving the package layout would depends in more details of how that is done. It could also probably be fixed directly, but this would require figuring out where that old URL came from and what, exactly, the bounds are of what the test intends (or should intend) to test.

Byron reacted with thumbs up emoji

# test config_reader/writer methods
sm.config_reader()
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp