-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(tests): locate test files into a root file
- Loading branch information
1 parent
afc5ec5
commit 75e6bb5
Showing
3 changed files
with
144 additions
and
136 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
""" | ||
Created on Jul 15 2020 | ||
@author: Joan Hérisson | ||
""" | ||
import filecmp | ||
import os | ||
import tempfile | ||
|
||
from retropath2_wrapper.__main__ import create_logger | ||
from retropath2_wrapper.Args import RETCODES | ||
from retropath2_wrapper.RetroPath2 import retropath2 | ||
from tests.main_test import Main_test | ||
|
||
|
||
class TestRetropath2(Main_test): | ||
def setUp(self): | ||
self.logger = create_logger(__name__, 'DEBUG') | ||
|
||
def test_src_in_sink(self): | ||
with tempfile.TemporaryDirectory() as tmpdir: | ||
r_code, result = retropath2( | ||
sink_file=self.lycopene_sink_csv, | ||
source_file=self.source_mnxm790_csv, | ||
rules_file=self.rules_csv, | ||
outdir=tmpdir, | ||
logger=self.logger, | ||
) | ||
self.assertEqual(r_code, RETCODES['SrcInSink']) | ||
|
||
def test_lycopene(self): | ||
with tempfile.TemporaryDirectory() as tempd: | ||
r_code, result = retropath2( | ||
sink_file=self.lycopene_sink_csv, | ||
source_file=self.lycopene_source_csv, | ||
rules_file=self.rulesd12_csv, | ||
outdir=tempd, | ||
) | ||
self.assertTrue( | ||
filecmp.cmp(os.path.join(result['outdir'], result['results']), self.lycopene_r20220104_results_csv) | ||
) | ||
|
||
""" | ||
# Set attributes | ||
maxDiff = None | ||
csv = '.csv' | ||
gz = '.gz' | ||
data_path = os_path.join(here, 'data') | ||
iml1515_sinkfile = os_path.join(data_path, 'lycopene', 'in', 'sink') + csv | ||
lycopene_sourcefile = os_path.join(data_path, 'lycopene', 'in', 'source') + csv | ||
alanine_sourcefile = os_path.join(data_path, 'alanine', 'in', 'source') + csv | ||
rulesfile = os_path.join(data_path, 'rules') + csv + gz | ||
rulesfile_d12 = os_path.join(data_path, 'rules_d12') + csv + gz | ||
ref_file = os_path.join(data_path, 'lycopene', 'out', 'r20220104', 'results') + csv | ||
# def test_light(self): | ||
# r_code, result = retropath2( | ||
# self.sinkfile+self.csv, | ||
# self.sourcefile+self.csv, | ||
# extract_gz( | ||
# self.rulesfile, | ||
# gettempdir()), | ||
# self.outdir, | ||
# dmin=16 | ||
# ) | ||
# self.assertTrue(cmp(result, self.ref_file+self.csv)) | ||
# def test_GZ(self): | ||
# r_code, result = retropath2( | ||
# self.sinkfile+self.csv, | ||
# self.sourcefile+self.csv, | ||
# self.rulesfile, | ||
# self.outdir, | ||
# dmin=16, | ||
# logger=self.logger | ||
# ) | ||
# self.assertTrue(cmp(result, self.ref_file+self.csv)) | ||
# def test_woCSV(self): | ||
# if not os_path.exists(self.outdir): | ||
# os_mkdir(self.outdir) | ||
# rulesfile = gunzip_to_csv( | ||
# self.rulesfile_d12, | ||
# self.outdir | ||
# ) | ||
# ext = '.dat' | ||
# r_code, result = retropath2( | ||
# self.sinkfile + ext, | ||
# self.sourcefile + ext, | ||
# rulesfile, | ||
# self.outdir, | ||
# dmin=12 | ||
# ) | ||
# self.assertTrue(cmp(result, self.ref_file+'_d12'+self.csv)) | ||
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import os | ||
import unittest | ||
|
||
|
||
class Main_test(unittest.TestCase): | ||
dataset_path = os.path.join(os.path.dirname(__file__), "data") | ||
|
||
# rules | ||
rules_csv = os.path.join(dataset_path, "rules.csv.gz") | ||
rulesd12_csv = os.path.join(dataset_path, "rules_d12.csv.gz") | ||
|
||
# empty | ||
empty_csv = os.path.join(dataset_path, "empty_file.csv") | ||
empty_sink_csv = os.path.join(dataset_path, "empty_sink.csv") | ||
source_weird_csv = os.path.join(dataset_path, "source.weird.csv") | ||
johndoe = os.path.join(dataset_path, "johndoe") | ||
|
||
# source | ||
source_csv = os.path.join(dataset_path, "source.csv") | ||
source_dat = os.path.join(dataset_path, "source.dat") | ||
source_mnxm790_csv = os.path.join(dataset_path, "source.mnxm790.csv") | ||
|
||
# sink | ||
sink_csv = os.path.join(dataset_path, "sink.csv") | ||
sink_dat = os.path.join(dataset_path, "sink.dat") | ||
|
||
# scope | ||
scope_csv = os.path.join(dataset_path, "scope.csv") | ||
scoped12_csv = os.path.join(dataset_path, "scope_d12.csv") | ||
|
||
# inchi | ||
inchi_csv = os.path.join(dataset_path, "inchi_test_cases.csv") | ||
|
||
# alanine | ||
alanine_sink_csv = os.path.join(dataset_path, "alanine", "in", "sink.csv") | ||
alanine_source_csv = os.path.join(dataset_path, "alanine", "in", "source.csv") | ||
|
||
# lycopene | ||
lycopene_sink_csv = os.path.join(dataset_path, "lycopene", "in", "sink.csv") | ||
lycopene_source_csv = os.path.join(dataset_path, "lycopene", "in", "source.csv") | ||
lycopene_r20210127_results_csv = os.path.join(dataset_path, "lycopene", "out", "r20210127", "results.csv") | ||
lycopene_r20210127_source_csv = os.path.join(dataset_path, "lycopene", "out", "r20210127", "source-in-sink.csv") | ||
lycopene_r20210127_target_csv = os.path.join(dataset_path, "lycopene", "out", "r20210127", "target_scope.csv") | ||
lycopene_r20220104_results_csv = os.path.join(dataset_path, "lycopene", "out", "r20220104", "results.csv") | ||
lycopene_r20220104_source_csv = os.path.join(dataset_path, "lycopene", "out", "r20220104", "source-in-sink.csv") | ||
lycopene_r20220104_target_csv = os.path.join(dataset_path, "lycopene", "out", "r20220104", "target_scope.csv") | ||
|
This file was deleted.
Oops, something went wrong.