diff --git a/Lib/test/test_shutil.py b/Lib/test/test_shutil.py index 1eb5e892e81..9509d2a69f9 100644 --- a/Lib/test/test_shutil.py +++ b/Lib/test/test_shutil.py @@ -132,7 +132,7 @@ def test_rmtree_errors(self): filename = os.path.join(tmpdir, "tstfile") with self.assertRaises(OSError) as cm: shutil.rmtree(filename) - if os.name == 'nt': + if cm.exception.filename.endswith('*.*'): rm_name = os.path.join(filename, '*.*') else: rm_name = filename