Skip to content

Commit

Permalink
Merge pull request #320 from tovrstra/safe-python
Browse files Browse the repository at this point in the history
Use sys.executable instead of "python".
  • Loading branch information
tovrstra authored Jun 4, 2024
2 parents 35fd980 + ddd9332 commit a9e209d
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions iodata/test/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import functools
import os
import subprocess
import sys

from numpy.testing import assert_allclose, assert_equal

Expand Down Expand Up @@ -55,15 +56,16 @@ def test_convert_one_manfmt(tmpdir):

def test_script_one_autofmt(tmpdir):
def myconvert(infn, outfn):
subprocess.run(["python", "-m", "iodata.__main__", infn, outfn], check=True)
subprocess.run([sys.executable, "-m", "iodata.__main__", infn, outfn], check=True)

_check_convert_one(myconvert, tmpdir)


def test_script_one_manfmt(tmpdir):
def myconvert(infn, outfn):
subprocess.run(
["python", "-m", "iodata.__main__", infn, outfn, "-i", "fchk", "-o", "xyz"], check=True
[sys.executable, "-m", "iodata.__main__", infn, outfn, "-i", "fchk", "-o", "xyz"],
check=True,
)

_check_convert_one(myconvert, tmpdir)
Expand Down Expand Up @@ -94,15 +96,15 @@ def test_convert_many_manfmt(tmpdir):

def test_script_many_autofmt(tmpdir):
def myconvert(infn, outfn):
subprocess.run(["python", "-m", "iodata.__main__", infn, outfn, "-m"], check=True)
subprocess.run([sys.executable, "-m", "iodata.__main__", infn, outfn, "-m"], check=True)

_check_convert_many(myconvert, tmpdir)


def test_script_many_manfmt(tmpdir):
def myconvert(infn, outfn):
subprocess.run(
["python", "-m", "iodata.__main__", infn, outfn, "-m", "-i", "fchk", "-o", "xyz"],
[sys.executable, "-m", "iodata.__main__", infn, outfn, "-m", "-i", "fchk", "-o", "xyz"],
check=True,
)

Expand Down

0 comments on commit a9e209d

Please sign in to comment.