Skip to content

Commit

Permalink
Merge pull request #384 from ISA-tools/develop
Browse files Browse the repository at this point in the history
Develop final merge for v0.12
  • Loading branch information
Zigur authored Jan 30, 2021
2 parents 2d17989 + 805d777 commit c47fa61
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 185 deletions.
11 changes: 6 additions & 5 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
[run]
source = isatools
omit =
/docs/*
/features/*
/tests/*
/isatools/io/isatab_configurator.py
/isatools/io/storage_adapter.py
docs/*
features/*
tests/*
isatools/convert/experimental/*
isatools/net/storage_adapter.py
isatools/io/isatab_configurator.py

[report]
exclude_lines =
Expand Down
Empty file.
File renamed without changes.
9 changes: 2 additions & 7 deletions isatools/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -3371,7 +3371,8 @@ def next_process(self, val):
if val is not None and not isinstance(val, Process):
raise AttributeError(
'Process.next_process must be a Process '
'or None; got {0}:{1}'.format(val, type(val)))
'or None; got {0}:{1}'.format(val, type(val))
)
else:
self.__next_process = val

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

# def __repr__(self):
# return 'Process(name="{0.name}", ' \
# 'executes_protocol={0.executes_protocol}, ' \
# 'date="{0.date}", performer="{0.performer}", ' \
# 'inputs={0.inputs}, outputs={0.outputs})'.format(self)
#
def __hash__(self):
return hash(repr(self))

Expand Down
165 changes: 0 additions & 165 deletions isatools/net/mtbls-assay-definition2dict.py

This file was deleted.

15 changes: 9 additions & 6 deletions tests/test_sampletab2isatab.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import tempfile
import shutil

SLOW_TESTS = int(os.getenv('SLOW_TESTS', '0'))

def setUpModule():
if not os.path.exists(utils.DATA_DIR):
Expand All @@ -24,23 +25,25 @@ def setUp(self):
def tearDown(self):
shutil.rmtree(self._tmp_dir)

def test_sampletab2json_test_1(self):
def test_sampletab2isatab_test_1(self):
with open(os.path.join(self._sampletab_dir, "test1.txt")) as sampletab_fp:
sampletab2isatab.convert(source_sampletab_fp=sampletab_fp, target_dir=self._tmp_dir)

def test_sampletab2json_test_2(self):
def test_sampletab2isatab_test_2(self):
with open(os.path.join(self._sampletab_dir, "test2.txt")) as sampletab_fp:
sampletab2isatab.convert(source_sampletab_fp=sampletab_fp, target_dir=self._tmp_dir)

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

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

@unittest.skip("skipping test that hangs on like forever")
def test_sampletab2json_GSB_718(self):
@unittest.skip("slow")
def test_sampletab2isatab_GSB_718(self):
with open(os.path.join(self._sampletab_dir, "GSB-718.txt")) as sampletab_fp:
sampletab2isatab.convert(source_sampletab_fp=sampletab_fp, target_dir=self._tmp_dir)
15 changes: 13 additions & 2 deletions tests/test_sra2isatab.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@
import tempfile
import zipfile

from unittest.mock import patch
from isatools.tests import utils
from isatools.net import sra2isatab

SLOW_TESTS = int(os.getenv('SLOW_TESTS', '0'))


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

# https://www.ebi.ac.uk/ena/data/view/SRA108974&display=xml
# https://www.ebi.ac.uk/ena/data/view/SRA108974&display=xml

def test_sra_import(self):
@unittest.skipIf(not SLOW_TESTS, "slow")
def test_sra_import(self, mock_call):
zipped_bytes = sra2isatab.sra_to_isatab_batch_convert('SRA108974')
mock_call.assert_called_with()
with open(os.path.join(self._tmp_dir, 'o.zip'), 'wb') as zip_fp:
shutil.copyfileobj(zipped_bytes, zip_fp, length=131072)

Expand All @@ -42,3 +47,9 @@ def test_sra_import(self):
sorted([os.path.basename(x) for x in zip_fp.namelist()]),
['a_wgs-genomic.txt', 'i_SRA108974.txt', 's_SRA108974.txt']
)

@patch("subprocess.call")
def test_sra_import_mocked(self, mock_call):
with self.assertRaises(FileNotFoundError, msg='as subprocess.call is mocked files are nor generated'):
sra2isatab.sra_to_isatab_batch_convert('SRA108974')
mock_call.assert_called_with('java', '-jar')

0 comments on commit c47fa61

Please sign in to comment.