summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_cmd_line_script.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_cmd_line_script.py')
-rw-r--r--Lib/test/test_cmd_line_script.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/test/test_cmd_line_script.py b/Lib/test/test_cmd_line_script.py
index adfb8ce..44a5487 100644
--- a/Lib/test/test_cmd_line_script.py
+++ b/Lib/test/test_cmd_line_script.py
@@ -499,6 +499,16 @@ class CmdLineTest(unittest.TestCase):
self.assertNotIn(b'is a package', err)
self.assertNotIn(b'Traceback', err)
+ def test_hint_when_triying_to_import_a_py_file(self):
+ with support.temp_dir() as script_dir, \
+ support.change_cwd(path=script_dir):
+ # Create invalid *.pyc as empty file
+ with open('asyncio.py', 'wb'):
+ pass
+ err = self.check_dash_m_failure('asyncio.py')
+ self.assertIn(b"Try using 'asyncio' instead "
+ b"of 'asyncio.py' as the module name", err)
+
def test_dash_m_init_traceback(self):
# These were wrapped in an ImportError and tracebacks were
# suppressed; see Issue 14285