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

Fix CI problems #74

Merged
merged 3 commits into from
Apr 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions .github/workflows/test-suite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ jobs:
strategy:
matrix:
CONDA_PY:
- 3.9
- 3.8
- 3.7
- "3.11"
- "3.10"
- "3.9"
INTEGRATIONS: [""]
include:
- CONDA_PY: 3.9
- CONDA_PY: "3.11"
INTEGRATIONS: 'all-optionals'

steps:
Expand Down Expand Up @@ -70,6 +70,8 @@ jobs:
run: |
python -c "import paths_cli"
py.test -vv --cov --cov-report xml:cov.xml
- uses: codecov/codecov-action@v2
- uses: codecov/codecov-action@v4
with:
files: ./cov.xml
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
4 changes: 2 additions & 2 deletions paths_cli/tests/commands/test_md.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
make_1d_traj, CalvinistDynamics

class TestProgressReporter(object):
def setup(self):
def setup_method(self):
self.progress = ProgressReporter(timestep=None, update_freq=5)

@pytest.mark.parametrize('timestep', [None, 0.1])
Expand All @@ -38,7 +38,7 @@ def test_report_progress(self, n_steps, force, capsys):
assert out == ""

class TestEnsembleSatisfiedContinueConditions(object):
def setup(self):
def setup_method(self):
cv = paths.CoordinateFunctionCV('x', lambda x: x.xyz[0][0])
vol_A = paths.CVDefinedVolume(cv, float("-inf"), 0.0)
vol_B = paths.CVDefinedVolume(cv, 1.0, float("inf"))
Expand Down
2 changes: 1 addition & 1 deletion paths_cli/tests/compiling/_gendocs/test_docs_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from paths_cli.compiling.core import CategoryCompiler

class TestDocsGenerator:
def setup(self):
def setup_method(self):
self.required_parameter = Parameter(
name="req_param",
loader=None,
Expand Down
6 changes: 3 additions & 3 deletions paths_cli/tests/compiling/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def mock_named_object_factory(dct):


class TestParameter:
def setup(self):
def setup_method(self):
self.loader = Mock(
return_value='foo',
json_type='string',
Expand Down Expand Up @@ -131,7 +131,7 @@ class TestInstanceCompilerPlugin:
def _builder(req_param, opt_default=10, opt_override=100):
return f"{req_param}, {opt_default}, {opt_override}"

def setup(self):
def setup_method(self):
identity = lambda x: x
self.parameters = [
Parameter('req_param', identity, json_type="string"),
Expand Down Expand Up @@ -227,7 +227,7 @@ def test_call(self):


class TestCategoryCompiler:
def setup(self):
def setup_method(self):
self.compiler = CategoryCompiler(
{'foo': mock_named_object_factory},
'foo_compiler'
Expand Down
2 changes: 1 addition & 1 deletion paths_cli/tests/compiling/test_cvs.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@


class TestMDTrajFunctionCV:
def setup(self):
def setup_method(self):
self.ad_pdb = data_filename("ala_small_traj.pdb")
self.yml = "\n".join([
"name: phi", "type: mdtraj", "topology: " + self.ad_pdb,
Expand Down
4 changes: 2 additions & 2 deletions paths_cli/tests/compiling/test_engines.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@
import mdtraj as md

class TestOpenMMEngineBuilder(object):
def setup(self):
def setup_method(self):
self.cwd = os.getcwd()
self.yml = "\n".join([
"type: openmm", "name: engine", "system: system.xml",
"integrator: integrator.xml", "topology: ad.pdb",
"n_steps_per_frame: 10", "n_frames_max: 10000"
])

def teardown(self):
def teardown_method(self):
os.chdir(self.cwd)

def _create_files(self, tmpdir):
Expand Down
2 changes: 1 addition & 1 deletion paths_cli/tests/compiling/test_plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from unittest.mock import Mock

class TestCompilerPlugin:
def setup(self):
def setup_method(self):
self.plugin_class = Mock(category='foo')
self.plugin = CategoryPlugin(self.plugin_class)
self.aliased_plugin = CategoryPlugin(self.plugin_class,
Expand Down
2 changes: 1 addition & 1 deletion paths_cli/tests/compiling/test_root_compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def test_canonical_name(input_name):


class TestCategoryCompilerProxy:
def setup(self):
def setup_method(self):
self.compiler = CategoryCompiler(None, "foo")
self.compiler.named_objs['bar'] = 'baz'
self.proxy = _CategoryCompilerProxy('foo')
Expand Down
4 changes: 2 additions & 2 deletions paths_cli/tests/compiling/test_volumes.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from paths_cli.compiling.volumes import *

class TestBuildCVVolume:
def setup(self):
def setup_method(self):
self.yml = "\n".join(["type: cv-volume", "cv: {func}",
"lambda_min: 0", "lambda_max: 1"])

Expand Down Expand Up @@ -90,7 +90,7 @@ def test_build_cv_volume(self, inline, periodic):


class TestBuildCombinationVolume:
def setup(self):
def setup_method(self):
from openpathsampling.experimental.storage.collective_variables \
import CollectiveVariable
self.cv = CollectiveVariable(lambda s: s.xyz[0][0]).named('foo')
Expand Down
2 changes: 1 addition & 1 deletion paths_cli/tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@


class TestOpenPathSamplingCLI(object):
def setup(self):
def setup_method(self):
def make_mock(name, helpless=False, return_val=None):
if return_val is None:
return_val = name
Expand Down
6 changes: 3 additions & 3 deletions paths_cli/tests/test_file_copying.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from paths_cli.file_copying import *

class Test_PRECOMPUTE_CVS(object):
def setup(self):
def setup_method(self):
self.tmpdir = tempfile.mkdtemp()
self.storage_filename = os.path.join(self.tmpdir, "test.nc")
self.storage = paths.Storage(self.storage_filename, mode='w')
Expand All @@ -21,7 +21,7 @@ def setup(self):
self.cv_y = paths.CoordinateFunctionCV("y", lambda s: s.xyz[0][1])
self.storage.save([self.cv_x, self.cv_y])

def teardown(self):
def teardown_method(self):
self.storage.close()

for filename in os.listdir(self.tmpdir):
Expand Down Expand Up @@ -53,7 +53,7 @@ def test_make_blocks(blocksize):


class TestPrecompute(object):
def setup(self):
def setup_method(self):
class RunOnceFunction(object):
def __init__(self):
self.previously_seen = set([])
Expand Down
44 changes: 22 additions & 22 deletions paths_cli/tests/test_parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class TestArgument(ParameterTest):
# testing

class ParamInstanceTest(object):
def setup(self):
def setup_method(self):
pes = paths.engines.toy.Gaussian(1, [1.0, 1.0], [0.0, 0.0])
integ = paths.engines.toy.LangevinBAOABIntegrator(0.01, 0.1, 2.5)
topology = paths.engines.toy.Topology(n_spatial=2, n_atoms=1,
Expand Down Expand Up @@ -129,16 +129,16 @@ def _getter_test(self, getter):
assert obj.__uuid__ == self.obj.__uuid__
assert obj == self.obj

def teardown(self):
def teardown_method(self):
for temp_f in os.listdir(self.tempdir):
os.remove(os.path.join(self.tempdir, temp_f))
os.rmdir(self.tempdir)


class TestENGINE(ParamInstanceTest):
PARAMETER = ENGINE
def setup(self):
super(TestENGINE, self).setup()
def setup_method(self):
super(TestENGINE, self).setup_method()
self.get_arg = {'name': 'engine', 'number': 0, 'only': None,
'only-named': None}
self.obj = self.engine
Expand All @@ -162,8 +162,8 @@ def test_cannot_guess(self):

class TestSCHEME(ParamInstanceTest):
PARAMETER = SCHEME
def setup(self):
super(TestSCHEME, self).setup()
def setup_method(self):
super(TestSCHEME, self).setup_method()
self.get_arg = {'name': 'scheme', 'number': 0, 'only': None,
'only-named': None, 'bad-name': 'foo'}
self.obj = self.scheme
Expand All @@ -183,8 +183,8 @@ def test_bad_get(self):

class TestINIT_CONDS(ParamInstanceTest):
PARAMETER = INIT_CONDS
def setup(self):
super(TestINIT_CONDS, self).setup()
def setup_method(self):
super(TestINIT_CONDS, self).setup_method()
self.traj = make_1d_traj([-0.1, 1.0, 4.4, 7.7, 10.01])
ensemble = self.scheme.network.sampling_ensembles[0]
self.sample_set = paths.SampleSet([
Expand Down Expand Up @@ -300,8 +300,8 @@ def test_cannot_guess(self):

class TestINIT_SNAP(ParamInstanceTest):
PARAMETER = INIT_SNAP
def setup(self):
super(TestINIT_SNAP, self).setup()
def setup_method(self):
super(TestINIT_SNAP, self).setup_method()
traj = make_1d_traj([1.0, 2.0])
self.other_snap = traj[0]
self.init_snap = traj[1]
Expand Down Expand Up @@ -360,8 +360,8 @@ def _getter_test(self, getter):

class TestCVS(MultiParamInstanceTest):
PARAMETER = CVS
def setup(self):
super(TestCVS, self).setup()
def setup_method(self):
super(TestCVS, self).setup_method()
self.get_arg = {'name': ["x"], 'number': [0]}
self.obj = self.cv

Expand All @@ -372,8 +372,8 @@ def test_get(self, getter):

class TestSTATES(MultiParamInstanceTest):
PARAMETER = STATES
def setup(self):
super(TestSTATES, self).setup()
def setup_method(self):
super(TestSTATES, self).setup_method()
self.get_arg = {'name': ["A"], 'number': [0]}
self.obj = self.state_A

Expand Down Expand Up @@ -411,32 +411,32 @@ class TestMULTI_VOLUME(TestSTATES, MULTITest):

class TestMULTI_ENGINE(MULTITest):
PARAMETER = MULTI_ENGINE
def setup(self):
super(TestMULTI_ENGINE, self).setup()
def setup_method(self):
super(TestMULTI_ENGINE, self).setup_method()
self.get_arg = {'name': ["engine"], 'number': [0]}
self.obj = self.engine


class TestMulti_NETWORK(MULTITest):
PARAMETER = MULTI_NETWORK
def setup(self):
super(TestMulti_NETWORK, self).setup()
def setup_method(self):
super(TestMulti_NETWORK, self).setup_method()
self.get_arg = {'name': ['network'], 'number': [0]}
self.obj = self.network


class TestMULTI_SCHEME(MULTITest):
PARAMETER = MULTI_SCHEME
def setup(self):
super(TestMULTI_SCHEME, self).setup()
def setup_method(self):
super(TestMULTI_SCHEME, self).setup_method()
self.get_arg = {'name': ['scheme'], 'number': [0]}
self.obj = self.scheme


class TestMULTI_TAG(MULTITest):
PARAMETER = MULTI_TAG
def setup(self):
super(TestMULTI_TAG, self).setup()
def setup_method(self):
super(TestMULTI_TAG, self).setup_method()
self.obj = make_1d_traj([1.0, 2.0, 3.0])
self.get_arg = {'name': ['traj']}

Expand Down
10 changes: 5 additions & 5 deletions paths_cli/tests/test_plugin_management.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def test_ops_plugin():
assert plugin.requires_lib == (1, 2)

class PluginLoaderTest(object):
def setup(self):
def setup_method(self):
self.expected_section = {'pathsampling': "Simulation",
'contents': "Miscellaneous"}

Expand Down Expand Up @@ -51,8 +51,8 @@ def test_call(self, command):


class TestFilePluginLoader(PluginLoaderTest):
def setup(self):
super().setup()
def setup_method(self):
super().setup_method()
# use our own commands dir as a file-based plugin
cmds_init = pathlib.Path(paths_cli.commands.__file__).resolve()
self.commands_dir = cmds_init.parent
Expand All @@ -64,8 +64,8 @@ def _make_candidate(self, command):


class TestNamespacePluginLoader(PluginLoaderTest):
def setup(self):
super().setup()
def setup_method(self):
super().setup_method()
self.namespace = "paths_cli.commands"
self.loader = NamespacePluginLoader(self.namespace, OPSCommandPlugin)
self.plugin_type = 'namespace'
Expand Down
2 changes: 1 addition & 1 deletion paths_cli/tests/test_utils.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from paths_cli.utils import *

class TestOrderedSet:
def setup(self):
def setup_method(self):
self.set = OrderedSet(['a', 'b', 'a', 'c', 'd', 'c', 'd'])

def test_len(self):
Expand Down
4 changes: 2 additions & 2 deletions paths_cli/tests/wizard/test_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def test_force_exit():
force_exit("foo", None)

class TestEvalHelperFunc:
def setup(self):
def setup_method(self):
self.param_helper = {
'str': "help_string",
'method': lambda help_args, context: f"help_{help_args}"
Expand All @@ -39,7 +39,7 @@ def test_call_eval(self, helper_type):
assert help_func("eval") == _LONG_EVAL_HELP

class TestHelper:
def setup(self):
def setup_method(self):
self.helper = Helper(help_func=lambda s, ctx: s)

def test_help_string(self):
Expand Down
4 changes: 2 additions & 2 deletions paths_cli/tests/wizard/test_parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class TestWizardParameter:
def _reverse(string):
return "".join(reversed(string))

def setup(self):
def setup_method(self):
self.parameter = WizardParameter(
name='foo',
ask="How should I {do_what}?",
Expand Down Expand Up @@ -79,7 +79,7 @@ def test_from_proxy_call_existing(self):


class TestFromWizardPrerequisite:
def setup(self):
def setup_method(self):
# For this model, user input should be a string that represents an
# integer. The self._create method repeats the input string, e.g.,
# "1" => "11", and wraps the result in self.Wrapper. This is the
Expand Down
Loading
Loading