Skip to content
Snippets Groups Projects

Speedup tests

Merged Bryan BRANCOTTE requested to merge speedup-tests into master
Files
5
@@ -11,6 +11,7 @@ import glob
from django.contrib.auth import get_user_model
from django.db.models import Value
from django.db.models.functions import Concat
from django.test import SimpleTestCase
from django.urls import reverse
from parameterized import parameterized
@@ -539,15 +540,10 @@ class ContributionE2ETestCase(TransactionTestCaseWithRequestsCache):
}
yield item
@parameterized.expand(
[
entry_path
for entry_path in glob.glob(
os.path.join(os.path.dirname(__file__), "*.yaml")
)
]
)
def test_entry(self, entry_path):
def actual_test_entry_file(self, entry_file):
self.actual_test_entry(os.path.join(os.path.dirname(__file__), entry_file))
def actual_test_entry(self, entry_path):
# load the test data
entry_data = yaml.load(
open(entry_path, "r", encoding="utf8"), Loader=yaml.FullLoader
@@ -638,3 +634,91 @@ class ContributionE2ETestCase(TransactionTestCaseWithRequestsCache):
with NamedTemporaryFile(delete=False, suffix=".html") as f:
f.write(response.content)
return f.name
class ContributionE2ETestCase02(ContributionE2ETestCase):
def test_entry(self):
self.actual_test_entry_file(entry_file="test_activity_computation_and_storage_pIC50_2380_002_e-9.yaml")
class ContributionE2ETestCase03(ContributionE2ETestCase):
def test_entry(self):
self.actual_test_entry_file(entry_file="test_activity_computation_and_storage_pIC50_4_9846073_e-6.yaml")
class ContributionE2ETestCase04(ContributionE2ETestCase):
def test_entry(self):
self.actual_test_entry_file(entry_file="test_activity_computation_and_storage_pIC50_639_39406_e-3.yaml")
class ContributionE2ETestCase05(ContributionE2ETestCase):
def test_entry(self):
self.actual_test_entry_file(entry_file="test_activity_computation_and_storage_pIC50_6_85_e-0.yaml")
class ContributionE2ETestCase06(ContributionE2ETestCase):
def test_entry(self):
self.actual_test_entry_file(entry_file="test_basic_entry.yaml")
class ContributionE2ETestCase07(ContributionE2ETestCase):
def test_entry(self):
self.actual_test_entry_file(entry_file="test_complex_no_pfam.yaml")
class ContributionE2ETestCase08(ContributionE2ETestCase):
def test_entry(self):
self.actual_test_entry_file(entry_file="test_entry_28.yaml")
class ContributionE2ETestCase09(ContributionE2ETestCase):
def test_entry(self):
self.actual_test_entry_file(entry_file="test_simple_heterodimer_208.yaml")
class ContributionE2ETestCase10(ContributionE2ETestCase):
def test_entry(self):
self.actual_test_entry_file(entry_file="test_simple_heterodimer.yaml")
class ContributionE2ETestCase11(ContributionE2ETestCase):
def test_entry(self):
self.actual_test_entry_file(entry_file="test_simple_stabilized_heterodimer.yaml")
class ContributionE2ETestCase12(ContributionE2ETestCase):
def test_entry(self):
self.actual_test_entry_file(entry_file="test_SPD00000304.yaml")
class ContributionE2ETestCase13(ContributionE2ETestCase):
def test_entry(self):
self.actual_test_entry_file(entry_file="test_stabilizer_204.yaml")
class ContributionE2ETestCase14(ContributionE2ETestCase):
def test_entry(self):
self.actual_test_entry_file(entry_file="test_with_all_tests.yaml")
class ContributionE2ETestCase15(ContributionE2ETestCase):
def test_entry(self):
self.actual_test_entry_file(entry_file="test_with_pk_test.yaml")
class CheckAllTestAreTested(SimpleTestCase):
@parameterized.expand(
[
entry_path
for entry_path in glob.glob(
os.path.join(os.path.dirname(__file__), "*.yaml")
)
]
)
def test_entry_file_are_tested(self, entry_file):
# a dummy test to check that the file name is found in the current python scripts
# I had to remove the initial use of parametrized in order to run scenario in parallel
entry_file = entry_file.split('/')[-1]
with open(__file__, 'r') as src:
self.assertTrue(any([entry_file in line for line in src.readlines()]), entry_file + " not tested")
Loading