-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
51 additions
and
7 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 |
---|---|---|
|
@@ -4,13 +4,7 @@ | |
import pytest | ||
|
||
__author__ = "Vijini Mallawaarachchi" | ||
__copyright__ = "Copyright 2020, GraphBin2 Project" | ||
__credits__ = ["Vijini Mallawaarachchi", "Anuradha Wickramarachchi", "Yu Lin"] | ||
__license__ = "BSD" | ||
__version__ = "1.2.0" | ||
__maintainer__ = "Vijini Mallawaarachchi" | ||
__email__ = "[email protected]" | ||
__status__ = "Development" | ||
__credits__ = ["Vijini Mallawaarachchi"] | ||
|
||
|
||
TEST_ROOTDIR = Path(__file__).parent | ||
|
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,50 @@ | ||
import subprocess | ||
from pathlib import Path | ||
|
||
import pytest | ||
|
||
__author__ = "Vijini Mallawaarachchi" | ||
__credits__ = ["Vijini Mallawaarachchi"] | ||
|
||
|
||
TEST_ROOTDIR = Path(__file__).parent | ||
|
||
|
||
@pytest.fixture(scope="session") | ||
def tmp_dir(tmpdir_factory): | ||
return tmpdir_factory.mktemp("tmp") | ||
|
||
|
||
@pytest.fixture(autouse=True) | ||
def workingdir(tmp_dir, monkeypatch): | ||
"""set the working directory for all tests""" | ||
monkeypatch.chdir(tmp_dir) | ||
|
||
|
||
def exec_command(cmnd, stdout=subprocess.PIPE, stderr=subprocess.PIPE): | ||
"""executes shell command and returns stdout if completes exit code 0 | ||
Parameters | ||
---------- | ||
cmnd : str | ||
shell command to be executed | ||
stdout, stderr : streams | ||
Default value (PIPE) intercepts process output, setting to None | ||
blocks this.""" | ||
|
||
proc = subprocess.Popen(cmnd, shell=True, stdout=stdout, stderr=stderr) | ||
out, err = proc.communicate() | ||
if proc.returncode != 0: | ||
raise RuntimeError(f"FAILED: {cmnd}\n{err}") | ||
return out.decode("utf8") if out is not None else None | ||
|
||
|
||
def test_gfa2fasta_help(): | ||
"""test gfa2fasta help message""" | ||
cmd = "gfa2fasta --help" | ||
exec_command(cmd) | ||
|
||
|
||
def test_prepResult_help(): | ||
"""test prepResult help message""" | ||
cmd = "prepResult --help" | ||
exec_command(cmd) |