Skip to content

Commit

Permalink
Fix linting (mypy errors)
Browse files Browse the repository at this point in the history
  • Loading branch information
nicoddemus committed Jun 7, 2020
1 parent e9f9190 commit c943991
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions testing/test_pathlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ def setuptestfs(self, path):

def test_smoke_test(self, path1):
obj = import_module(path1.join("execfile.py"))
assert obj.x == 42
assert obj.x == 42 # type: ignore[attr-defined]
assert obj.__name__ == "execfile"

def test_renamed_dir_creates_mismatch(self, tmpdir, monkeypatch):
Expand Down Expand Up @@ -177,24 +177,24 @@ def test_dir(self, tmpdir):
def test_a(self, path1):
otherdir = path1.join("otherdir")
mod = import_module(otherdir.join("a.py"))
assert mod.result == "got it"
assert mod.result == "got it" # type: ignore[attr-defined]
assert mod.__name__ == "otherdir.a"

def test_b(self, path1):
otherdir = path1.join("otherdir")
mod = import_module(otherdir.join("b.py"))
assert mod.stuff == "got it"
assert mod.stuff == "got it" # type: ignore[attr-defined]
assert mod.__name__ == "otherdir.b"

def test_c(self, path1):
otherdir = path1.join("otherdir")
mod = import_module(otherdir.join("c.py"))
assert mod.value == "got it"
assert mod.value == "got it" # type: ignore[attr-defined]

def test_d(self, path1):
otherdir = path1.join("otherdir")
mod = import_module(otherdir.join("d.py"))
assert mod.value2 == "got it"
assert mod.value2 == "got it" # type: ignore[attr-defined]

def test_import_after(self, tmpdir):
tmpdir.ensure("xxxpackage", "__init__.py")
Expand Down Expand Up @@ -266,7 +266,7 @@ def foo(x): return 40 + x
def test_importmode_importlib(self, simple_module):
"""importlib mode does not change sys.path"""
module = import_module(simple_module, mode="importlib")
assert module.foo(2) == 42
assert module.foo(2) == 42 # type: ignore[attr-defined]
assert simple_module.dirname not in sys.path

def test_importmode_twice_is_different_module(self, simple_module):
Expand All @@ -279,7 +279,7 @@ def test_no_meta_path_found(self, simple_module, monkeypatch):
"""Even without any meta_path should still import module"""
monkeypatch.setattr(sys, "meta_path", [])
module = import_module(simple_module, mode="importlib")
assert module.foo(2) == 42
assert module.foo(2) == 42 # type: ignore[attr-defined]

# mode='importlib' fails if no spec is found to load the module
import importlib.util
Expand Down

0 comments on commit c943991

Please sign in to comment.