Skip to content

Commit c47fa61

Browse files
authored
Merge pull request #384 from ISA-tools/develop
Develop final merge for v0.12
2 parents 2d17989 + 805d777 commit c47fa61

File tree

7 files changed

+30
-185
lines changed

7 files changed

+30
-185
lines changed

Diff for: .coveragerc

+6-5
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
[run]
22
source = isatools
33
omit =
4-
/docs/*
5-
/features/*
6-
/tests/*
7-
/isatools/io/isatab_configurator.py
8-
/isatools/io/storage_adapter.py
4+
docs/*
5+
features/*
6+
tests/*
7+
isatools/convert/experimental/*
8+
isatools/net/storage_adapter.py
9+
isatools/io/isatab_configurator.py
910

1011
[report]
1112
exclude_lines =

Diff for: isatools/convert/experimental/__init__.py

Whitespace-only changes.
File renamed without changes.

Diff for: isatools/model.py

+2-7
Original file line numberDiff line numberDiff line change
@@ -3371,7 +3371,8 @@ def next_process(self, val):
33713371
if val is not None and not isinstance(val, Process):
33723372
raise AttributeError(
33733373
'Process.next_process must be a Process '
3374-
'or None; got {0}:{1}'.format(val, type(val)))
3374+
'or None; got {0}:{1}'.format(val, type(val))
3375+
)
33753376
else:
33763377
self.__next_process = val
33773378

@@ -3383,12 +3384,6 @@ def __repr__(self):
33833384
def __str__(self):
33843385
return """{0}(name={1.name})""".format(self.__class__.__name__, self)
33853386

3386-
# def __repr__(self):
3387-
# return 'Process(name="{0.name}", ' \
3388-
# 'executes_protocol={0.executes_protocol}, ' \
3389-
# 'date="{0.date}", performer="{0.performer}", ' \
3390-
# 'inputs={0.inputs}, outputs={0.outputs})'.format(self)
3391-
#
33923387
def __hash__(self):
33933388
return hash(repr(self))
33943389

Diff for: isatools/net/mtbls-assay-definition2dict.py

-165
This file was deleted.

Diff for: tests/test_sampletab2isatab.py

+9-6
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import tempfile
66
import shutil
77

8+
SLOW_TESTS = int(os.getenv('SLOW_TESTS', '0'))
89

910
def setUpModule():
1011
if not os.path.exists(utils.DATA_DIR):
@@ -24,23 +25,25 @@ def setUp(self):
2425
def tearDown(self):
2526
shutil.rmtree(self._tmp_dir)
2627

27-
def test_sampletab2json_test_1(self):
28+
def test_sampletab2isatab_test_1(self):
2829
with open(os.path.join(self._sampletab_dir, "test1.txt")) as sampletab_fp:
2930
sampletab2isatab.convert(source_sampletab_fp=sampletab_fp, target_dir=self._tmp_dir)
3031

31-
def test_sampletab2json_test_2(self):
32+
def test_sampletab2isatab_test_2(self):
3233
with open(os.path.join(self._sampletab_dir, "test2.txt")) as sampletab_fp:
3334
sampletab2isatab.convert(source_sampletab_fp=sampletab_fp, target_dir=self._tmp_dir)
3435

35-
def test_sampletab2json_GSB_3(self):
36+
@unittest.skipIf(not SLOW_TESTS, "slow")
37+
def test_sampletab2isatab_GSB_3(self):
3638
with open(os.path.join(self._sampletab_dir, "GSB-3.txt")) as sampletab_fp:
3739
sampletab2isatab.convert(source_sampletab_fp=sampletab_fp, target_dir=self._tmp_dir)
3840

39-
def test_sampletab2json_GSB_537(self):
41+
@unittest.skipIf(not SLOW_TESTS, "slow")
42+
def test_sampletab2isatab_GSB_537(self):
4043
with open(os.path.join(self._sampletab_dir, "GSB-537.txt")) as sampletab_fp:
4144
sampletab2isatab.convert(source_sampletab_fp=sampletab_fp, target_dir=self._tmp_dir)
4245

43-
@unittest.skip("skipping test that hangs on like forever")
44-
def test_sampletab2json_GSB_718(self):
46+
@unittest.skip("slow")
47+
def test_sampletab2isatab_GSB_718(self):
4548
with open(os.path.join(self._sampletab_dir, "GSB-718.txt")) as sampletab_fp:
4649
sampletab2isatab.convert(source_sampletab_fp=sampletab_fp, target_dir=self._tmp_dir)

Diff for: tests/test_sra2isatab.py

+13-2
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,12 @@
55
import tempfile
66
import zipfile
77

8+
from unittest.mock import patch
89
from isatools.tests import utils
910
from isatools.net import sra2isatab
1011

12+
SLOW_TESTS = int(os.getenv('SLOW_TESTS', '0'))
13+
1114

1215
def setUpModule():
1316
if not os.path.exists(utils.DATA_DIR):
@@ -29,10 +32,12 @@ def setUp(self):
2932
# def tearDown(self):
3033
# shutil.rmtree(self._tmp_dir)
3134

32-
# https://www.ebi.ac.uk/ena/data/view/SRA108974&display=xml
35+
# https://www.ebi.ac.uk/ena/data/view/SRA108974&display=xml
3336

34-
def test_sra_import(self):
37+
@unittest.skipIf(not SLOW_TESTS, "slow")
38+
def test_sra_import(self, mock_call):
3539
zipped_bytes = sra2isatab.sra_to_isatab_batch_convert('SRA108974')
40+
mock_call.assert_called_with()
3641
with open(os.path.join(self._tmp_dir, 'o.zip'), 'wb') as zip_fp:
3742
shutil.copyfileobj(zipped_bytes, zip_fp, length=131072)
3843

@@ -42,3 +47,9 @@ def test_sra_import(self):
4247
sorted([os.path.basename(x) for x in zip_fp.namelist()]),
4348
['a_wgs-genomic.txt', 'i_SRA108974.txt', 's_SRA108974.txt']
4449
)
50+
51+
@patch("subprocess.call")
52+
def test_sra_import_mocked(self, mock_call):
53+
with self.assertRaises(FileNotFoundError, msg='as subprocess.call is mocked files are nor generated'):
54+
sra2isatab.sra_to_isatab_batch_convert('SRA108974')
55+
mock_call.assert_called_with('java', '-jar')

0 commit comments

Comments
 (0)