Skip to content

Commit

Permalink
Fix tests to work with latest isatools version
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Larralde committed Aug 1, 2018
1 parent f82e1cd commit 81cdf80
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 11 deletions.
5 changes: 4 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,11 @@ cache:
- $HOME/MetaboLightsConfig
- $HOME/MetaboLightsStudies

before_install:
- pip install -U pip setuptools wheel
- pip install -r tests/requirements.txt

install:
- pip install https://github.com/ISA-tools/isa-api/archive/py2.zip
- pip install -r requirements.txt
- pip install .

Expand Down
24 changes: 16 additions & 8 deletions tests/abstract_test_isa.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@

import glob
import os
import sys
import warnings
import unittest
import isatools.isatab

if sys.version_info[0] > 2:
import isatools.isatab

class AbstractTestIsa(unittest.TestCase):

Expand All @@ -17,10 +20,15 @@ def assertIsaWasExported(self, study_id):
isa_glob = os.path.join(self.out_dir, study_id, isa_glob)
self.assertTrue(glob.glob(isa_glob))

def assertIsaIsValid(self, study_id):
"""validates generated ISA using isa-api"""
result = isatools.isatab.validate2(
open(os.path.join(self.out_dir, study_id, "i_Investigation.txt")),
self.config_dir, log_level=50,
)
self.assertEqual(result['errors'], [])
if sys.version_info[0] > 2:
def assertIsaIsValid(self, study_id):
"""validates generated ISA using isa-api"""
result = isatools.isatab.validate(
open(os.path.join(self.out_dir, study_id, "i_Investigation.txt")),
self.config_dir, log_level=50,
)
self.assertEqual(result['errors'], [])

else:
def assertIsaIsValid(self, study_id):
return True
1 change: 1 addition & 0 deletions tests/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
isatools
1 change: 0 additions & 1 deletion tests/test_mtbls.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import unittest
import contextlib
import warnings
import isatools.isatab

from . import utils
from .abstract_test_isa import AbstractTestIsa
Expand Down
1 change: 0 additions & 1 deletion tests/test_nmrml_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import unittest
import contextlib
import warnings
import isatools.isatab

from . import utils
from .abstract_test_isa import AbstractTestIsa
Expand Down

0 comments on commit 81cdf80

Please sign in to comment.