From 0090d210fc2e22bd9762f98ce5fd1b2dfdc9300e Mon Sep 17 00:00:00 2001 From: tharvik Date: Mon, 11 Jul 2016 14:32:12 +0200 Subject: [PATCH] fix typeshed sync --- mypy/main.py | 3 ++- test-data/stdlib-samples/3.2/test/test_random.py | 2 +- test-data/stdlib-samples/3.2/test/test_shutil.py | 14 +++++++------- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/mypy/main.py b/mypy/main.py index 1d4fca7858683..572018c3a2bdb 100644 --- a/mypy/main.py +++ b/mypy/main.py @@ -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 # --use-python-path is no longer supported; explain why. if special_opts.use_python_path: diff --git a/test-data/stdlib-samples/3.2/test/test_random.py b/test-data/stdlib-samples/3.2/test/test_random.py index cec22efc0b832..aa697381e2246 100644 --- a/test-data/stdlib-samples/3.2/test/test_random.py +++ b/test-data/stdlib-samples/3.2/test/test_random.py @@ -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 diff --git a/test-data/stdlib-samples/3.2/test/test_shutil.py b/test-data/stdlib-samples/3.2/test/test_shutil.py index 32e0fd153bcf8..226b61c445825 100644 --- a/test-data/stdlib-samples/3.2/test/test_shutil.py +++ b/test-data/stdlib-samples/3.2/test/test_shutil.py @@ -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") def test_make_tarball(self) -> None: # creating something to tar tmpdir = self.mkdtemp() @@ -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() @@ -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 @@ -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 @@ -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() @@ -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: