From a1bfebd30cb6d189d69cc21205445b6f31d73654 Mon Sep 17 00:00:00 2001 From: blueloveTH Date: Tue, 6 Jan 2026 15:18:04 +0800 Subject: [PATCH] Update 300_import.py --- tests/300_import.py | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/tests/300_import.py b/tests/300_import.py index e33bc5b1..38ce806c 100644 --- a/tests/300_import.py +++ b/tests/300_import.py @@ -3,7 +3,14 @@ try: except ImportError: exit(0) -os.chdir('tests') +import sys +is_pyc = sys.argv[0].endswith('.pyc') + +if is_pyc: + os.chdir('tmp/tests') +else: + os.chdir('tests') + assert os.getcwd().endswith('tests') import test1 @@ -49,8 +56,11 @@ from math import ( cos ) -# test reload (dummy) -import importlib -importlib.reload(test2.a) - assert __import__('math').pi > 3 + +# test reload (dummy) +if not is_pyc: + import importlib + importlib.reload(test2.a) + +