Skip to content

Commit 7e27e28

Browse files
committed
Refactor test_log_info_to_console to use environment variables for installation directory
1 parent 63bb7e7 commit 7e27e28

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/tests/test_iop_commun.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ def test_log_info_to_console():
4747
random_string = ''.join(random.choice(letters) for i in range(10))
4848
commun.log_info(random_string)
4949
# check $IRISINSTALLDIR/mgr/messages.log last line
50-
with open(os.path.join(os.environ['IRISINSTALLDIR'], 'mgr', 'messages.log'), 'r') as file:
50+
install_dir = os.getenv('IRISINSTALLDIR',None) or os.getenv('ISC_PACKAGE_INSTALLDIR',None)
51+
with open(os.path.join(install_dir, 'mgr', 'messages.log'), 'r') as file:
5152
lines = file.readlines()
5253
last_line = lines[-1]
5354
assert random_string in last_line
@@ -60,7 +61,8 @@ def test_log_info_to_console_from_method():
6061
random_string = ''.join(random.choice(letters) for i in range(10))
6162
commun.trace(message=random_string, to_console=True)
6263
# check $IRISINSTALLDIR/mgr/messages.log last line
63-
with open(os.path.join(os.environ['IRISINSTALLDIR'], 'mgr', 'messages.log'), 'r') as file:
64+
install_dir = os.getenv('IRISINSTALLDIR',None) or os.getenv('ISC_PACKAGE_INSTALLDIR',None)
65+
with open(os.path.join(install_dir, 'mgr', 'messages.log'), 'r') as file:
6466
lines = file.readlines()
6567
last_line = lines[-1]
6668
assert random_string in last_line

0 commit comments

Comments
 (0)