Skip to content
Closed
Show file tree
Hide file tree
Changes from all 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
3 changes: 2 additions & 1 deletion mypy/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,8 @@ def parse_version(v: str) -> Tuple[int, int]:

options = Options()
special_opts = argparse.Namespace()
parser.parse_args(args, SplitNamespace(options, special_opts, 'special-opts:'))
namespace = SplitNamespace(options, special_opts, 'special-opts:')
parser.parse_args(args, namespace) # type: ignore

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.

This is fixed more simply by making SplitNamespace inherit from Namespace.


# --use-python-path is no longer supported; explain why.
if special_opts.use_python_path:
Expand Down
2 changes: 1 addition & 1 deletion test-data/stdlib-samples/3.2/test/test_random.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def test_seedargs(self) -> None:
for arg in [list(range(3)), {'one': 1}]:
self.assertRaises(TypeError, self.gen.seed, arg)
self.assertRaises(TypeError, self.gen.seed, 1, 2, 3, 4)
self.assertRaises(TypeError, type(self.gen), [])
self.assertRaises(TypeError, type(self.gen), []) # type: ignore

def test_choice(self) -> None:
choice = self.gen.choice
Expand Down
14 changes: 7 additions & 7 deletions test-data/stdlib-samples/3.2/test/test_shutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ def test_copy2(self) -> None:
self.assertEqual(getattr(file1_stat, 'st_flags'),
getattr(file2_stat, 'st_flags'))

@unittest.skipUnless(zlib, "requires zlib")
@unittest.skipUnless(zlib is not None, "requires zlib")

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.

For these I think the stub for skipUnless should take object, not bool.

def test_make_tarball(self) -> None:
# creating something to tar
tmpdir = self.mkdtemp()
Expand Down Expand Up @@ -505,8 +505,8 @@ def _create_files(self) -> Tuple[str, str, str]:
base_name = os.path.join(tmpdir2, 'archive')
return tmpdir, tmpdir2, base_name

@unittest.skipUnless(zlib, "Requires zlib")
@unittest.skipUnless(find_executable('tar') and find_executable('gzip'),
@unittest.skipUnless(zlib is not None, "Requires zlib")
@unittest.skipUnless((find_executable('tar') and find_executable('gzip')) is not None,
'Need the tar command to run')
def test_tarfile_vs_tar(self) -> None:
tmpdir, tmpdir2, base_name = self._create_files()
Expand Down Expand Up @@ -560,7 +560,7 @@ def test_tarfile_vs_tar(self) -> None:
tarball = base_name + '.tar'
self.assertTrue(os.path.exists(tarball))

@unittest.skipUnless(zlib, "Requires zlib")
@unittest.skipUnless(zlib is not None, "Requires zlib")
@unittest.skipUnless(ZIP_SUPPORT, 'Need zip support to run')
def test_make_zipfile(self) -> None:
# creating something to tar
Expand All @@ -584,7 +584,7 @@ def test_make_archive(self) -> None:
base_name = os.path.join(tmpdir, 'archive')
self.assertRaises(ValueError, make_archive, base_name, 'xxx')

@unittest.skipUnless(zlib, "Requires zlib")
@unittest.skipUnless(zlib is not None, "Requires zlib")
def test_make_archive_owner_group(self) -> None:
# testing make_archive with owner and group, with various combinations
# this works even if there's not gid/uid support
Expand Down Expand Up @@ -612,7 +612,7 @@ def test_make_archive_owner_group(self) -> None:
self.assertTrue(os.path.exists(res))


@unittest.skipUnless(zlib, "Requires zlib")
@unittest.skipUnless(zlib is not None, "Requires zlib")
@unittest.skipUnless(UID_GID_SUPPORT, "Requires grp and pwd support")
def test_tarfile_root_owner(self) -> None:
tmpdir, tmpdir2, base_name = self._create_files()
Expand Down Expand Up @@ -683,7 +683,7 @@ def _compare_dirs(self, dir1: str, dir2: str) -> List[str]:
diff.append(file_)
return diff

@unittest.skipUnless(zlib, "Requires zlib")
@unittest.skipUnless(zlib is not None, "Requires zlib")
def test_unpack_archive(self) -> None:
formats = ['tar', 'gztar', 'zip']
if BZ2_SUPPORTED:
Expand Down