Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use python executable from env #1174

Merged
merged 13 commits into from
Jul 18, 2023
Merged
2 changes: 1 addition & 1 deletion devtools/conda-envs/test_env.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ dependencies:
- openmmforcefields >=0.9.0
- openmmtools # may need to sort out ambermini/ambertools/parmed dependencies
- openmoltools # may need to sort out ambermini/ambertools/parmed dependencies (we don't want ambertools)
- parmed # may need to sort out ambermini/ambertools/parmed dependencies
- parmed
- pdbfixer
- pip
- progressbar2
Expand Down
7 changes: 5 additions & 2 deletions perses/tests/test_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
# GLOBAL IMPORTS
# ======================================================================

import sys

import pathlib
import pytest
import subprocess
Expand All @@ -25,13 +27,14 @@
def run_script_file(file_path, cmd_args=None):
"""Run through the shell a python script."""
with enter_temp_directory():
cmd = ["python", file_path]
# Make sure we grab the python executable in our env
cmd = [f"{sys.executable}", file_path]
print(cmd)
# Extend cmd list with given cmd_args
if cmd_args:
cmd.extend(cmd_args)
try:
subprocess.run(cmd, capture_output=True, check=True)
subprocess.run(cmd, capture_output=True, check=True, shell=True)
except subprocess.CalledProcessError as error:
raise Exception(f"Example {file_path} failed. STDERR: {error.stderr.decode()}")

Expand Down
Loading