Skip to content

Commit bdb3c24

Browse files
committed
Python3.sif: broken ipython magic
Fixes #320
1 parent 0a5271e commit bdb3c24

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

tests/test_python3.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
subprocess.run('apptainer', check=False)
2222
PREFIX = f'apptainer run {pth}'
2323
PREFIX_MOUNT = f'apptainer run --home={cwd}:/home/ {pth}'
24+
IPYTHON = f'{PREFIX} ipython'
2425
PYTHON = f'{PREFIX} python'
2526
PYTHON_MOUNT = f'{PREFIX_MOUNT} python'
2627
PLINK = f'{PREFIX} plink'
@@ -37,6 +38,7 @@
3738
f'--mount type=bind,source={cwd},target={cwd} ' +
3839
'--platform linux/amd64 ' +
3940
'ghcr.io/comorment/python3')
41+
IPYTHON = f'{PREFIX} ipython'
4042
PYTHON = f'{PREFIX} python'
4143
PYTHON_MOUNT = f'{PREFIX_MOUNT} python'
4244
PLINK = f'{PREFIX} plink'
@@ -46,6 +48,7 @@
4648
except FileNotFoundError:
4749
# neither apptainer nor docker found, fall back to plain python
4850
# presumably because we are running on the client
51+
IPYTHON = 'ipython'
4952
PYTHON = 'python'
5053
PYTHON_MOUNT = 'python'
5154
PLINK = 'plink'
@@ -151,3 +154,8 @@ def test_python3_import_pandas_scipy_stats():
151154
call = f'{PYTHON_MOUNT} -c "import pandas as pd; from scipy import *"'
152155
out = subprocess.run(call, shell=True, check=False)
153156
assert out.returncode == 0
157+
158+
def test_python3_ipython_magic():
159+
call = f'{IPYTHON} -c "get_ipython().run_line_magic(\'matplotlib\', \'inline\')"'
160+
out = subprocess.run(call, shell=True, check=False)
161+
assert out.returncode == 0

0 commit comments

Comments
 (0)