Skip to content

Commit

Permalink
tests(retropath2): support windows
Browse files Browse the repository at this point in the history
  • Loading branch information
guillaume-gricourt committed Nov 25, 2022
1 parent 5b197ef commit c053484
Show file tree
Hide file tree
Showing 6 changed files with 2,181 additions and 16 deletions.
8 changes: 1 addition & 7 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
runs-on: ${{ matrix.os }}-latest
strategy:
matrix:
os: ["macos-latest", "ubuntu-latest", "windows-latest"]
os: ["macos", "ubuntu", "windows"]
defaults:
run:
shell: bash -l {0}
Expand All @@ -37,9 +37,3 @@ jobs:
run: |
conda install -y python pytest pytest-mock
python -m pytest
- name: "Archive production artifacts"
uses: actions/upload-artifact@v3
with:
name: test_windows
path: |
tests/data/results_windows.csv
2 changes: 1 addition & 1 deletion retropath2_wrapper/Args.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ def _add_arguments(parser):
'--timeout',
type=int,
default=DEFAULT_TIMEOUT,
help=f'Defines the time after which the program will stop and return calculated results (default: {DEFAULT_TIMEOUT})'
help=f'Defines the time after which the program (RDKit MCS Aggregation) will stop and return calculated results (default: {DEFAULT_TIMEOUT}).'
)
# parser.add_argument('--forward' , action='store_true')

Expand Down
2,169 changes: 2,169 additions & 0 deletions tests/data/lycopene/out/r20220104/results.7325.csv

Large diffs are not rendered by default.

Binary file added tests/data/rules_d12_7325.csv.gz
Binary file not shown.
16 changes: 8 additions & 8 deletions tests/functional/test_retropath2.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,25 +36,25 @@ def test_lycopene(self):
r_code, result = retropath2(
sink_file=self.lycopene_sink_csv,
source_file=self.lycopene_source_csv,
rules_file=self.rulesd12_csv,
rules_file=self.rulesd12_7325_csv,
outdir=tmpdir,
timeout=10,
logger=self.logger,
)
# Specific test for windows due to Github Runner memory consumption.
# Only check first lines.
if sys.platform == 'win32':
with open(result['outdir'] + "/" + result['results']) as fid:
result_lines = fid.read().splitlines()
with open(self.lycopene_r20220104_results_csv) as fid:
with open(self.lycopene_r20220104_results_7325_csv) as fid:
theorical_lines = fid.read().splitlines()
nb_lines = len(result_lines)

identical_line = 0
for i, the in enumerate(theorical_lines):
if the != result_lines[i]:
identical_line = i
break
self.assertTrue(identical_line > 5)
self.assertTrue(nb_lines > 5)
self.assertTrue(result_lines, theorical_lines[:nb_lines])
else:
filecmp.cmp(result['outdir'] + "/" + result['results'], self.lycopene_r20220104_results_csv)
shutil.copyfile(result['outdir'] + "/" + result['results'], "mac.result.csv")
shutil.rmtree(tmpdir, ignore_errors=True)

"""
Expand Down
2 changes: 2 additions & 0 deletions tests/main_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class Main_test(unittest.TestCase):
# rules
rules_csv = os.path.join(dataset_path, "rules.csv.gz")
rulesd12_csv = os.path.join(dataset_path, "rules_d12.csv.gz")
rulesd12_7325_csv = os.path.join(dataset_path, "rules_d12_7325.csv.gz")

# empty
empty_csv = os.path.join(dataset_path, "empty_file.csv")
Expand Down Expand Up @@ -45,5 +46,6 @@ class Main_test(unittest.TestCase):
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_results_7325_csv = os.path.join(dataset_path, "lycopene", "out", "r20220104", "results.7325.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")

0 comments on commit c053484

Please sign in to comment.