diff --git a/.github/workflows/conda-tests.yml b/.github/workflows/conda-tests.yml new file mode 100644 index 00000000..dc9a52b8 --- /dev/null +++ b/.github/workflows/conda-tests.yml @@ -0,0 +1,45 @@ +# Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy +# More GitHub Actions for Azure: https://github.com/Azure/actions +# More info on Python, GitHub Actions, and Azure App Service: https://aka.ms/python-webapps-actions + +name: Build Conda Environment And Run Python Tests + +on: + push: + branches: + - main + - avelez-dev + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + + defaults: + run: + shell: bash -l {0} + + steps: + - uses: actions/checkout@v4 + + - name: Set up Python version + uses: actions/setup-python@v1 + with: + python-version: '3.9' + + - name: Setup Miniconda + uses: conda-incubator/setup-miniconda@v2 + with: + miniconda-version: "latest" + channels: bioconda, conda-forge, defaults + use-only-tar-bz2: true + auto-update-conda: true + auto-activate-base: true + + - name: Create and start Conda environment. Run tests. + run: | + echo "Creating Conda Environment from environment.yml" + conda env create -f environment.yml + conda activate tdc-conda-env + python run_tests.py + conda deactivate diff --git a/environment.yml b/environment.yml index 3caed9e8..4aa999fe 100644 --- a/environment.yml +++ b/environment.yml @@ -10,7 +10,6 @@ dependencies: - python=3.9.13 - pip=23.3.1 - pandas=2.1.4 - - rdkit=2023.9.5 - requests=2.31.0 - scikit-learn=1.3.0 - seaborn=0.12.2 @@ -18,3 +17,4 @@ dependencies: - pip: - cellxgene-census==1.10.2 - PyTDC==0.4.1 + - rdkit==2023.9.5 diff --git a/run_tests.py b/run_tests.py new file mode 100644 index 00000000..981f21b7 --- /dev/null +++ b/run_tests.py @@ -0,0 +1,9 @@ +import unittest + +if __name__ == '__main__': + loader = unittest.TestLoader() + start_dir = 'tdc/test' + suite = loader.discover(start_dir) + + runner = unittest.TextTestRunner() + runner.run(suite) \ No newline at end of file diff --git a/tdc/test/dev_tests/chem_utils_test/test_molconverter.py b/tdc/test/dev_tests/chem_utils_test/test_molconverter.py index a84ec632..cd034247 100644 --- a/tdc/test/dev_tests/chem_utils_test/test_molconverter.py +++ b/tdc/test/dev_tests/chem_utils_test/test_molconverter.py @@ -19,6 +19,7 @@ def setUp(self): print(os.getcwd()) pass + @unittest.skip("dev test") def test_MolConvert(self): from tdc.chem_utils import MolConvert @@ -34,6 +35,7 @@ def test_MolConvert(self): MolConvert.eligible_format() + # @unittest.skip("dev test") def tearDown(self): print(os.getcwd()) diff --git a/tdc/test/dev_tests/chem_utils_test/test_molfilter.py b/tdc/test/dev_tests/chem_utils_test/test_molfilter.py index 7c998e4f..9b0476c6 100644 --- a/tdc/test/dev_tests/chem_utils_test/test_molfilter.py +++ b/tdc/test/dev_tests/chem_utils_test/test_molfilter.py @@ -19,12 +19,14 @@ def setUp(self): print(os.getcwd()) pass + @unittest.skip("dev test") def test_MolConvert(self): from tdc.chem_utils import MolFilter filters = MolFilter(filters=["PAINS"], HBD=[0, 6]) filters(["CCSc1ccccc1C(=O)Nc1onc2c1CCC2"]) + # @unittest.skip("dev test") def tearDown(self): print(os.getcwd()) diff --git a/tdc/test/dev_tests/chem_utils_test/test_oracles.py b/tdc/test/dev_tests/chem_utils_test/test_oracles.py index 608a0848..10dededf 100644 --- a/tdc/test/dev_tests/chem_utils_test/test_oracles.py +++ b/tdc/test/dev_tests/chem_utils_test/test_oracles.py @@ -19,6 +19,7 @@ def setUp(self): print(os.getcwd()) pass + @unittest.skip("dev test") def test_Oracle(self): from tdc import Oracle @@ -34,6 +35,7 @@ def test_Oracle(self): oracle = Oracle(name="Hop") x = oracle(["CC(=O)OC1=CC=CC=C1C(=O)O", "C1=CC=C(C=C1)C=O"]) + @unittest.skip("dev test") def test_distribution(self): from tdc import Evaluator diff --git a/tdc/test/dev_tests/utils_tests/test_misc_utils.py b/tdc/test/dev_tests/utils_tests/test_misc_utils.py index 6d2daa9a..8e4ab331 100644 --- a/tdc/test/dev_tests/utils_tests/test_misc_utils.py +++ b/tdc/test/dev_tests/utils_tests/test_misc_utils.py @@ -19,6 +19,7 @@ def setUp(self): print(os.getcwd()) pass + @unittest.skip("dev test") def test_neg_sample(self): from tdc.multi_pred import PPI @@ -30,6 +31,7 @@ def test_neg_sample(self): # data = ADME(name='Caco2_Wang') # x = data.label_distribution() + @unittest.skip("dev test") def test_get_label_map(self): from tdc.multi_pred import DDI from tdc.utils import get_label_map @@ -38,22 +40,26 @@ def test_get_label_map(self): split = data.get_split() get_label_map(name="DrugBank", task="DDI") + @unittest.skip("dev test") def test_balanced(self): from tdc.single_pred import HTS data = HTS(name="SARSCoV2_3CLPro_Diamond") data.balanced(oversample=True, seed=42) + @unittest.skip("dev test") def test_cid2smiles(self): from tdc.utils import cid2smiles smiles = cid2smiles(2248631) + @unittest.skip("dev test") def test_uniprot2seq(self): from tdc.utils import uniprot2seq seq = uniprot2seq("P49122") + @unittest.skip("dev test") def test_to_graph(self): from tdc.multi_pred import DTI @@ -87,6 +93,7 @@ def test_to_graph(self): ) # output: {'pyg_graph': the PyG graph object, 'index_to_entities': a dict map from ID in the data to node ID in the PyG object, 'split': {'train': df, 'valid': df, 'test': df}} + # @unittest.skip("dev test") def tearDown(self): print(os.getcwd()) diff --git a/tdc/test/dev_tests/utils_tests/test_splits.py b/tdc/test/dev_tests/utils_tests/test_splits.py index ae3e12c2..7377a723 100644 --- a/tdc/test/dev_tests/utils_tests/test_splits.py +++ b/tdc/test/dev_tests/utils_tests/test_splits.py @@ -19,12 +19,14 @@ def setUp(self): print(os.getcwd()) pass + @unittest.skip("dev test") def test_random_split(self): from tdc.single_pred import ADME data = ADME(name="Caco2_Wang") split = data.get_split(method="random") + @unittest.skip("dev test") def test_scaffold_split(self): ## requires RDKit from tdc.single_pred import ADME @@ -32,6 +34,7 @@ def test_scaffold_split(self): data = ADME(name="Caco2_Wang") split = data.get_split(method="scaffold") + @unittest.skip("dev test") def test_cold_start_split(self): from tdc.multi_pred import DTI @@ -60,18 +63,21 @@ def test_cold_start_split(self): self.assertEqual(0, len(train_entity.intersection(test_entity))) self.assertEqual(0, len(valid_entity.intersection(test_entity))) + @unittest.skip("dev test") def test_combination_split(self): from tdc.multi_pred import DrugSyn data = DrugSyn(name="DrugComb") split = data.get_split(method="combination") + @unittest.skip("dev test") def test_time_split(self): from tdc.multi_pred import DTI data = DTI(name="BindingDB_Patent") split = data.get_split(method="time", time_column="Year") + @unittest.skip("dev test") def test_tearDown(self): print(os.getcwd()) diff --git a/tdc/test/test_benchmark.py b/tdc/test/test_benchmark.py index f92275a8..b4b78083 100644 --- a/tdc/test/test_benchmark.py +++ b/tdc/test/test_benchmark.py @@ -57,3 +57,6 @@ def test_ADME_evaluate_many(self): for my_group in self.group: self.assertTrue(my_group["name"] in results) + +if __name__ == "__main__": + unittest.main() \ No newline at end of file diff --git a/tdc/test/test_dataloaders.py b/tdc/test/test_dataloaders.py index 9732a244..c5de2fa9 100644 --- a/tdc/test/test_dataloaders.py +++ b/tdc/test/test_dataloaders.py @@ -41,3 +41,6 @@ def test_generation(self): def tearDown(self): print(os.getcwd()) shutil.rmtree(os.path.join(os.getcwd(), "data")) + +if __name__ == "__main__": + unittest.main() \ No newline at end of file diff --git a/tdc/test/test_functions.py b/tdc/test/test_functions.py index 1236c296..e713512e 100644 --- a/tdc/test/test_functions.py +++ b/tdc/test/test_functions.py @@ -50,3 +50,6 @@ def tearDown(self): shutil.rmtree(os.path.join(os.getcwd(), "data")) if os.path.exists(os.path.join(os.getcwd(), "oracle")): shutil.rmtree(os.path.join(os.getcwd(), "oracle")) + +if __name__ == "__main__": + unittest.main() \ No newline at end of file diff --git a/tstfile b/tstfile deleted file mode 100644 index e69de29b..00000000