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

Commit46a739d

Browse files
committed
Hoistimport git to module level in test module
Because it's going to be necessary to express things in terms of itin parametrization markings, in order for mypy to show the expectederrors for names that are available dynamically but deliberatelystatic type errors.
1 parent859e38c commit46a739d

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

‎test/deprecation/test_attributes.py

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44

55
importpytest
66

7+
importgit
78

8-
deftest_cannot_get_undefined()->None:
9-
importgit
109

10+
deftest_cannot_get_undefined()->None:
1111
withpytest.raises(AttributeError):
1212
git.foo
1313

@@ -19,21 +19,16 @@ def test_cannot_import_undefined() -> None:
1919

2020
deftest_util_alias_access_resolves()->None:
2121
"""These resolve for now, though they're private we do not guarantee this."""
22-
importgit
23-
2422
assertgit.utilisgit.index.util
2523

2624

2725
deftest_util_alias_import_resolves()->None:
2826
fromgitimportutil
29-
importgit
3027

3128
utilisgit.index.util
3229

3330

3431
deftest_util_alias_access_warns()->None:
35-
importgit
36-
3732
withpytest.deprecated_call()asctx:
3833
git.util
3934

@@ -72,8 +67,6 @@ def test_util_alias_import_warns() -> None:
7267
@_parametrize_by_private_alias
7368
deftest_private_module_alias_access_resolves(name:str,fullname:str)->None:
7469
"""These resolve for now, though they're private we do not guarantee this."""
75-
importgit
76-
7770
assertgetattr(git,name)isimportlib.import_module(fullname)
7871

7972

@@ -85,8 +78,6 @@ def test_private_module_alias_import_resolves(name: str, fullname: str) -> None:
8578

8679
@_parametrize_by_private_alias
8780
deftest_private_module_alias_access_warns(name:str,fullname:str)->None:
88-
importgit
89-
9081
withpytest.deprecated_call()asctx:
9182
getattr(git,name)
9283

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp