Skip to content

Commit

Permalink
skip broken tests (#1074)
Browse files Browse the repository at this point in the history
* skip broken tests

* fix testing decorators

* skip test
  • Loading branch information
mikemhenry authored Aug 19, 2022
1 parent 52e324c commit 37da4fb
Show file tree
Hide file tree
Showing 11 changed files with 72 additions and 29 deletions.
4 changes: 3 additions & 1 deletion perses/tests/test_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,15 @@
import tempfile
from perses.analysis.analysis import Analysis
from unittest import skipIf
import pytest

running_on_github_actions = os.environ.get('GITHUB_ACTIONS', None) == 'true'
################################################################################
# TEST ANALYSIS
################################################################################

@skipIf(running_on_github_actions, "Skip analysis test on GH Actions. Currently broken")
#@skipIf(running_on_github_actions, "Skip analysis test on GH Actions. Currently broken")
@pytest.mark.skip(reason="Skip analysis test on GH Actions. Currently broken")
def test_analysis():
"""Test analysis tools.
"""
Expand Down
7 changes: 5 additions & 2 deletions perses/tests/test_fah.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import os
from unittest import skipIf
import pytest
running_on_github_actions = os.environ.get('GITHUB_ACTIONS', None) == 'true'

#default arguments for tests
Expand All @@ -26,7 +27,8 @@
forcefield_files = ['amber/ff14SB.xml','amber/tip3p_standard.xml','amber/tip3p_HFE_multivalent.xml']


@skipIf(running_on_github_actions, "Skip slow test on GH Actions")
#@skipIf(running_on_github_actions, "Skip slow test on GH Actions")
@pytest.mark.skip(reason="Skip slow test on GH Actions")
def test_pipeline_small_molecule():
"""Test setup of small molecule transformation in complex and solvent (for BACE from JACS set) on Folding@home"""
from pkg_resources import resource_filename
Expand Down Expand Up @@ -76,7 +78,8 @@ def test_pipeline_small_molecule_solvent():
for val in projs.values():
os.system(f"rm -r {val}")

@skipIf(running_on_github_actions, "Skip slow test on GH Actions")
#@skipIf(running_on_github_actions, "Skip slow test on GH Actions")
@pytest.mark.skip(reason="Skip slow test on GH Actions")
def test_pipeline_protein():
"""Test setup of protein mutation in complex and apo (for barnase-barstar) for Folding@home"""
from pkg_resources import resource_filename
Expand Down
16 changes: 12 additions & 4 deletions perses/tests/test_geometry_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from collections import namedtuple, OrderedDict
import copy
from unittest import skipIf
import pytest
try:
from urllib.request import urlopen
from io import StringIO
Expand Down Expand Up @@ -908,9 +909,11 @@ def align_molecules(mol1, mol2):
new_to_old_atom_mapping[new_index] = old_index
return new_to_old_atom_mapping


#@skipIf(running_on_github_actions, "Skip advanced test on GH Actions")
@attr('advanced')
@nottest
@skipIf(running_on_github_actions, "Skip advanced test on GH Actions")
@pytest.mark.skip(reason="Skip advanced test on GH Actions")
def test_mutate_from_all_to_all(): # TODO: fix protein mutations
"""
Make sure mutations are successful between every possible pair of before-and-after residues
Expand Down Expand Up @@ -968,9 +971,11 @@ def test_mutate_from_all_to_all(): # TODO: fix protein mutations
if np.isnan(potential_without_units):
raise Exception("Energy after proposal is NaN")


#@skipIf(running_on_github_actions, "Skip advanced test on GH Actions")
@attr('advanced')
@nottest
@skipIf(running_on_github_actions, "Skip advanced test on GH Actions")
@pytest.mark.skip(reason="Skip advanced test on GH Actions")
def test_propose_lysozyme_ligands(): # TODO: fix protein mutations
"""
Try proposing geometries for all T4 ligands from all T4 ligands
Expand All @@ -981,9 +986,11 @@ def test_propose_lysozyme_ligands(): # TODO: fix protein mutations
proposals = make_geometry_proposal_array(smiles_list, forcefield=['data/T4-inhibitors.xml', 'data/gaff.xml'])
run_proposals(proposals)


#@skipIf(running_on_github_actions, "Skip advanced test on GH Actions")
@attr('advanced')
@nottest
@skipIf(running_on_github_actions, "Skip advanced test on GH Actions")
@pytest.mark.skip(reason="Skip advanced test on GH Actions")
def test_propose_kinase_inhibitors(): # TODO: fix protein mutations
from perses.tests.testsystems import KinaseInhibitorsTestSystem
testsystem = KinaseInhibitorsTestSystem()
Expand Down Expand Up @@ -1777,7 +1784,8 @@ def work_comparison(self, printer=False):


#@nottest
@skipIf(running_on_github_actions, "Skip deprecated test on GH Actions")
#@skipIf(running_on_github_actions, "Skip deprecated test on GH Actions")
@pytest.mark.skip(reason="Skip deprecated test on GH Actions")
def test_AnalyticalBeadSystems(transformation=[[3,4], [4,5], [3,5]], num_iterations=100):
"""
Function to assert that the forward and reverse works are equal and opposite, and that the variances of each work distribution is much less
Expand Down
12 changes: 9 additions & 3 deletions perses/tests/test_parallel.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import os
from nose.tools import nottest
from unittest import skipIf
import pytest

###
from perses.dispersed import parallel
Expand Down Expand Up @@ -34,7 +35,8 @@ def test_Parallelism_local():


# Run this test on a cluster to test parallelism
@skipIf(running_on_github_actions, "Skip helper function on GH Actions")
#@skipIf(running_on_github_actions, "Skip helper function on GH Actions")
@pytest.mark.skip(reason="Skip helper function on GH Actions")
def test_Parallelism_distributed():
"""
following function will create a distributed Parallelism instance and run all of the used methods.
Expand All @@ -48,8 +50,10 @@ def test_Parallelism_distributed():
run_parallelism(_parallel, data)



#@skipIf(running_on_github_actions, "Skip helper function on GH Actions")
@nottest
@skipIf(running_on_github_actions, "Skip helper function on GH Actions")
@pytest.mark.skip(reason="Skip helper function on GH Actions")
def run_parallelism(_parallel, data):
"""
helper function to run through the parallelism tests
Expand Down Expand Up @@ -111,8 +115,10 @@ def run_parallelism(_parallel, data):
assert all(i == j for i, j in zip(locals, run_all_futures)), f"run_all is returning {run_all_futures} instead of {dummy_function(data)}"



#@skipIf(running_on_github_actions, "Skip helper function on GH Actions")
@nottest
@skipIf(running_on_github_actions, "Skip helper function on GH Actions")
@pytest.mark.skip(reason="Skip helper function on GH Actions")
def dummy_function(_arg):
"""
dummy function to distribute;
Expand Down
14 changes: 9 additions & 5 deletions perses/tests/test_relative.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,10 @@ def test_simple_overlap_pairs(pairs=None):
print('{} -> {}'.format(pair[1],pair[0]))
test_simple_overlap(pair[1],pair[0])


#@skipIf(running_on_github_actions, "Skip helper function on GH Actions")
@nottest # This is, in fact, a helper function that is called in other working tests
@skipIf(running_on_github_actions, "Skip helper function on GH Actions")
@pytest.mark.skip(reason="Skip helper function on GH Actions")
def test_simple_overlap(name1='pentane', name2='butane', forcefield_kwargs=None, system_generator_kwargs=None):
"""Test that the variance of the hybrid -> real perturbation in vacuum is sufficiently small.
Expand Down Expand Up @@ -238,7 +240,8 @@ def test_simple_overlap(name1='pentane', name2='butane', forcefield_kwargs=None,
message += str(e)
raise Exception(message)

@skipIf(running_on_github_actions, "Skip expensive test on GH Actions")
#@skipIf(running_on_github_actions, "Skip expensive test on GH Actions")
@pytest.mark.skip(reason="Skip expensive test on GH Actions")
def test_hostguest_overlap():
"""Test that the variance of the endpoint->nonalchemical perturbation is sufficiently small for host-guest system in vacuum"""
topology_proposal, current_positions, new_positions = utils.generate_vacuum_hostguest_proposal()
Expand All @@ -252,8 +255,9 @@ def test_hostguest_overlap():
message += str(e)
raise Exception(message)

@skipIf(running_on_github_actions, "Skip broken test on GH Actions")
#@skipIf(running_on_github_actions, "Skip broken test on GH Actions")
@nottest # At the moment, the mapping between imatinib and nilotinib is faulty
@pytest.mark.skip(reason="Skip broken test on GH Actions")
def test_difficult_overlap():
"""Test that the variance of the endpoint->nonalchemical perturbation is sufficiently small for imatinib->nilotinib in solvent"""
name1 = 'imatinib'
Expand Down Expand Up @@ -1201,7 +1205,7 @@ def test_unsampled_endstate_energies_GPU():
RESTCapableHybridTopologyFactory and HybridTopologyFactory.
Test systems: alanine dipeptide in solvent and barstar in solvent
Only run this on a GPU as the CPU is too slow.
"""

Expand All @@ -1212,4 +1216,4 @@ def test_unsampled_endstate_energies_GPU():
run_unsampled_endstate_energies('barstar', use_point_energies=True, use_md_energies=True)

# Tyk2 -- Run point and MD energy validation tests
run_unsampled_endstate_energies('tyk2', use_point_energies=True, use_md_energies=True)
run_unsampled_endstate_energies('tyk2', use_point_energies=True, use_md_energies=True)
10 changes: 7 additions & 3 deletions perses/tests/test_relative_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import mdtraj as md
from openmmtools import states, alchemy, testsystems, cache
from unittest import skipIf
import pytest

from perses.tests.utils import enter_temp_directory

Expand Down Expand Up @@ -80,7 +81,8 @@ def test_parsed_yaml_generation():


# TODO fails as integrator not bound to context
@skipIf(running_on_github_actions, "Skip analysis test on GH Actions. Currently broken")
#@skipIf(running_on_github_actions, "Skip analysis test on GH Actions. Currently broken")
@pytest.mark.skip(reason="Skip analysis test on GH Actions. Currently broken")
def test_run_nonequilibrium_switching_move():
"""
Test that the NonequilibriumSwitchingMove changes lambda from 0 to 1 in multiple iterations
Expand Down Expand Up @@ -153,7 +155,8 @@ def test_run_nonequilibrium_switching_move():
# lambda_one_npy = np.stack([np.load(filename) for filename in lambda_one_filenames])
# assert np.shape(lambda_one_npy) == (n_iterations, n_work_values_per_iteration+1)

@skipIf(running_on_github_actions, "Skip analysis test on GH Actions. SLOW")
#@skipIf(running_on_github_actions, "Skip analysis test on GH Actions. SLOW")
@pytest.mark.skip(reason="Skip analysis test on GH Actions. SLOW")
def test_run_cdk2_iterations_repex():
"""
Ensure that we can instantiate and run a repex relative free energy calculation the cdk2 ligands in vacuum
Expand Down Expand Up @@ -203,7 +206,8 @@ def warn(*args, **kwargs):

# TODO: Check output

@skipIf(running_on_github_actions, "Skip analysis test on GH Actions. SLOW")
#@skipIf(running_on_github_actions, "Skip analysis test on GH Actions. SLOW")
@pytest.mark.skip(reason="Skip analysis test on GH Actions. SLOW")
def test_run_bace_spectator():
"""
Ensure that we can instantiate and run a repex relative free energy calculation the cdk2 ligands in vacuum
Expand Down
5 changes: 3 additions & 2 deletions perses/tests/test_samplers.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,16 @@
import os.path
from functools import partial
from unittest import skipIf

import pytest

running_on_github_actions = os.environ.get('GITHUB_ACTIONS', None) == 'true'

################################################################################
# TEST MCMCSAMPLER
################################################################################

@skipIf(running_on_github_actions, "Skip analysis test on GH Actions. Currently broken")
#@skipIf(running_on_github_actions, "Skip analysis test on GH Actions. Currently broken")
@pytest.mark.skip(reason="Skip analysis test on GH Actions. Currently broken")
def test_valence():
"""
Test valence-only test system.
Expand Down
6 changes: 5 additions & 1 deletion perses/tests/test_smc.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from perses.dispersed.utils import *
from openmmtools.states import ThermodynamicState, CompoundThermodynamicState
from perses.annihilation.lambda_protocol import RelativeAlchemicalState, LambdaProtocol
import pytest
#######################
running_on_github_actions = os.environ.get('GITHUB_ACTIONS', None) == 'true'

Expand All @@ -35,8 +36,10 @@
os.system(f"mkdir {trajectory_directory}")
#######################


#@skipIf(running_on_github_actions, "Skip helper function on GH Actions")
@nottest
@skipIf(running_on_github_actions, "Skip helper function on GH Actions")
@pytest.mark.skip(reason="Skip helper function on GH Actions")
def sMC_setup():
"""
function to setup local sMC
Expand Down Expand Up @@ -105,6 +108,7 @@ def sMC_setup():
assert decorrelated_1 == sorted(decorrelated_1_files), f"there is a discrepancy between the decorrelated 1 equilibrium states and the decorrelated equilibria saved to disk"
return ne_fep

@pytest.mark.skip(reason="Skip helper function on GH Actions")
def test_local_AIS():
"""
test local annealed importance sampling method in it's entirety
Expand Down
4 changes: 3 additions & 1 deletion perses/tests/test_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from perses.storage import NetCDFStorage, NetCDFStorageView

from unittest import skipIf
import pytest
running_on_github_actions = os.environ.get('GITHUB_ACTIONS', None) == 'true'

################################################################################
Expand Down Expand Up @@ -125,7 +126,8 @@ def test_write_object():
def run_sampler(sampler, niterations):
sampler.run(niterations)

@skipIf(running_on_github_actions, "Skip slow test on GH Actions.")
#@skipIf(running_on_github_actions, "Skip slow test on GH Actions.")
@pytest.mark.skip(reason="Skip slow test on GH Actions.")
def test_storage_with_samplers():
"""Test storage layer inside all samplers.
"""
Expand Down
16 changes: 11 additions & 5 deletions perses/tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@
import os
from perses.utils.openeye import smiles_to_oemol
from unittest import skipIf
import pytest

running_on_github_actions = os.environ.get('GITHUB_ACTIONS', None) == 'true'


# functions testing perses.utils.data
@skipIf(running_on_github_actions, "Skip: running on GH Actions")
#@skipIf(running_on_github_actions, "Skip: running on GH Actions")
@pytest.mark.skip(reason="Skip: running on GH Actions")
def test_get_data_filename(datafile='data/gaff2.xml'):
"""
Checks that function returns real path
Expand All @@ -33,7 +35,8 @@ def test_get_data_filename(datafile='data/gaff2.xml'):


# functions testing perses.utils.openeye
@skipIf(running_on_github_actions, "Skip: running on GH Actions")
#@skipIf(running_on_github_actions, "Skip: running on GH Actions")
@pytest.mark.skip(reason="Skip: running on GH Actions")
def test_extractPositionsFromOEMol(molecule=smiles_to_oemol('CC')):
"""
Generates an ethane OEMol from string and checks it returns positions of correct length and units
Expand All @@ -58,7 +61,8 @@ def test_extractPositionsFromOEMol(molecule=smiles_to_oemol('CC')):

return positions

@skipIf(running_on_github_actions, "Skip: running on GH Actions")
#@skipIf(running_on_github_actions, "Skip: running on GH Actions")
@pytest.mark.skip(reason="Skip: running on GH Actions")
def test_giveOpenmmPositionsToOEMol(positions=None, molecule=smiles_to_oemol('CC')):
"""
Checks that positions of an OEMol can be updated using openmm positions by shifting a molecule by 1 A
Expand Down Expand Up @@ -96,7 +100,8 @@ def test_giveOpenmmPositionsToOEMol(positions=None, molecule=smiles_to_oemol('CC

return updated_molecule

@skipIf(running_on_github_actions, "Skip full test on GH Actions.")
#@skipIf(running_on_github_actions, "Skip full test on GH Actions.")
@pytest.mark.skip(reason="Skip full test on GH Actions.")
def test_OEMol_to_omm_ff(molecule=smiles_to_oemol('CC')):
"""
Generating openmm objects for simulation from an OEMol object
Expand Down Expand Up @@ -137,7 +142,8 @@ def test_OEMol_to_omm_ff(molecule=smiles_to_oemol('CC')):
return system, positions, topology


@skipIf(running_on_github_actions, "Skip full test on GH Actions.")
#@skipIf(running_on_github_actions, "Skip full test on GH Actions.")
@pytest.mark.skip(reason="Skip full test on GH Actions.")
def run_oemol_test_suite(iupac='ethane'):
"""
Runs all of the oemol related tests for perses.utils.openeye
Expand Down
7 changes: 5 additions & 2 deletions perses/tests/test_visualization.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@
from pkg_resources import resource_filename
import os
from unittest import skipIf
import pytest

running_on_github_actions = os.environ.get('GITHUB_ACTIONS', None) == 'true'

@skipIf(running_on_github_actions, "Skip helper function on GH Actions")
#@skipIf(running_on_github_actions, "Skip helper function on GH Actions")
@pytest.mark.skip(reason="Skip helper function on GH Actions")
def test_protein_mutation():
input_directory = resource_filename("perses", "data/visualization/protein-mutation/")

Expand All @@ -24,7 +26,8 @@ def test_protein_mutation():
os.remove(os.path.join(input_directory, "frame-%05d.png" % (i)))
os.remove(os.path.join(input_directory, "movie.mp4"))

@skipIf(running_on_github_actions, "Skip helper function on GH Actions")
#@skipIf(running_on_github_actions, "Skip helper function on GH Actions")
@pytest.mark.skip(reason="Skip helper function on GH Actions")
def test_small_molecule():
input_directory = resource_filename("perses", "data/visualization/small-molecule")

Expand Down

0 comments on commit 37da4fb

Please sign in to comment.