forked from rh-impact/pl-heudiconv
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Get test passing & doing something mildly useful
- Loading branch information
Showing
2 changed files
with
17 additions
and
16 deletions.
There are no files selected for viewing
Binary file not shown.
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 |
---|---|---|
@@ -1,33 +1,34 @@ | ||
|
||
from unittest import TestCase | ||
from unittest import mock | ||
from heudiconv.heudiconv import Heudiconv | ||
|
||
from unittest import TestCase, mock | ||
from pl_heudiconv.heudiconv import Heudiconv | ||
import base64, os, shutil, tempfile | ||
|
||
class HeudiconvTests(TestCase): | ||
""" | ||
Test Heudiconv. | ||
""" | ||
def setUp(self): | ||
self.app = Heudiconv() | ||
self.inputdir = os.path.join(os.getcwd(), 'pl_heudiconv/tests/mock/inputdir') | ||
self.outputdir = tempfile.mkdtemp() | ||
|
||
def test_run(self): | ||
""" | ||
Test the run code. | ||
""" | ||
args = [] | ||
if self.app.TYPE == 'ds': | ||
args.append('inputdir') # you may want to change this inputdir mock | ||
args.append('outputdir') # you may want to change this outputdir mock | ||
|
||
# you may want to add more of your custom defined optional arguments to test | ||
# your app with | ||
# eg. | ||
# args.append('--custom-int') | ||
# args.append(10) | ||
args.append(self.inputdir) | ||
args.append(self.outputdir) | ||
|
||
options = self.app.parse_args(args) | ||
self.assertEqual(options.inputdir, self.inputdir) | ||
self.assertEqual(options.outputdir, self.outputdir) | ||
|
||
self.app.run(options) | ||
|
||
# write your own assertions | ||
self.assertEqual(options.outputdir, 'outputdir') | ||
expected_files = ['CHANGES', 'README', 'dataset_description.json', 'participants.json', 'participants.tsv', 'scans.json'] | ||
for expected in expected_files: | ||
self.assertTrue(os.path.exists(os.path.join( | ||
self.outputdir, 'Knee/(R)/', expected))) | ||
|
||
def tearDown(self): | ||
shutil.rmtree(self.outputdir) |