Skip to content

Commit

Permalink
Clear EMLE environment variables before each test.
Browse files Browse the repository at this point in the history
  • Loading branch information
lohedges committed Apr 8, 2024
1 parent 86a5d4e commit f39badf
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 48 deletions.
27 changes: 27 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import os
import pytest
import shlex
import subprocess


@pytest.fixture(autouse=True)
def wrapper():
"""
A wrapper function that clears the environment variables before each test
and stops the EMLE server after each test.
"""

# Clear the environment.

for env in os.environ:
if env.startswith("EMLE_"):
del os.environ[env]

yield

# Stop the EMLE server.
process = subprocess.run(
shlex.split("emle-stop"),
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
)
16 changes: 0 additions & 16 deletions tests/test_external.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,6 @@
import tempfile


@pytest.fixture(autouse=True)
def teardown():
"""
Clean up the environment.
"""

yield

# Stop the EMLE server.
process = subprocess.run(
shlex.split("emle-stop"),
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
)


def test_external_local_directory():
"""
Make sure that the server can run using an external callback for the in
Expand Down
16 changes: 0 additions & 16 deletions tests/test_interpolate.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,6 @@
import tempfile


@pytest.fixture(autouse=True)
def teardown():
"""
Clean up the environment.
"""

yield

# Stop the EMLE server.
process = subprocess.run(
shlex.split("emle-stop"),
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
)


def parse_mdinfo(mdinfo_file):
"""
Helper function to extract the total energy from AMBER mdinfo files.
Expand Down
16 changes: 0 additions & 16 deletions tests/test_qm_xyz.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,6 @@
import tempfile


@pytest.fixture(autouse=True)
def teardown():
"""
Clean up the environment.
"""

yield

# Stop the EMLE server.
process = subprocess.run(
shlex.split("emle-stop"),
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
)


def test_qm_xyz():
"""
Make sure that an xyz file for the QM region is written when requested.
Expand Down

0 comments on commit f39badf

Please sign in to comment.