Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[frozen] pyDKB.dataflow.stage tests #196

Open
wants to merge 28 commits into
base: pyDKB
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
4c1c44a
Added command line arguments tests.
Evildoor Nov 16, 2018
e1343c5
Updated a check_args method.
Evildoor Nov 19, 2018
1022253
Reworked mode tests.
Evildoor Nov 19, 2018
088e180
Added testing for arguments' interactions.
Evildoor Nov 19, 2018
339c3ca
Improved check_args method.
Evildoor Nov 20, 2018
1a56cd0
Removed unnecesary redefinition.
Evildoor Nov 20, 2018
dcbdeab
Reworked modes handling.
Evildoor Nov 20, 2018
3eaa413
Added long versions for eop and eom testing.
Evildoor Nov 20, 2018
1565684
Improved consistency: short version before long.
Evildoor Nov 20, 2018
be922c9
Added input files test.
Evildoor Nov 20, 2018
aa90f7c
Removed short version of override tests.
Evildoor Nov 20, 2018
cf56b0c
Moved override_hdfs_mode definition into a loop.
Evildoor Nov 20, 2018
8a37c7d
Improved readability in testing hdfs overrides.
Evildoor Nov 21, 2018
324978c
Moved repeating args definition into setUp().
Evildoor Nov 23, 2018
fdb498a
Added tests for config argument.
Evildoor Dec 14, 2018
42877e2
Improved config tests.
Evildoor Dec 17, 2018
9dc9aa0
Added 'incorrect' tests for mode, source and dest.
Evildoor Dec 18, 2018
19ca409
Improved the functions with 'short' argument.
Evildoor Dec 20, 2018
c3e4810
Updated tests for correct config.
Evildoor Jan 23, 2019
c81a096
Merge remote-tracking branch 'origin/pyDKB' into pyDKB-tests
Evildoor Apr 24, 2019
f795e24
Adapt tests to pyDKB changes.
Evildoor Apr 26, 2019
77ef71b
Add empty EOM tests.
Evildoor Apr 29, 2019
1d4feb2
Change value used to trigger an error.
Evildoor Apr 29, 2019
b5d6842
Rename a variable to improve readability.
Evildoor Apr 29, 2019
38a383e
Add raw strings processing test.
Evildoor Apr 29, 2019
c99f4c6
Replace repeating assignments with dict.update().
Evildoor Apr 29, 2019
e1df893
Add missing return value description.
Evildoor Apr 29, 2019
7dad261
Divide test_ProcessorStage.py per how-to: tests.
Evildoor Apr 30, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions Utils/Dataflow/pyDKB/dataflow/stage/tests/test_ProcessorStage.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,24 @@ def f(self):
setattr(ProcessorStageArgsTestCase, 'test_%s_%s' % (arg, val), f)


def add_arg_incorrect(arg, short=False):
if short:
val = 'i'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it would be better to use here 'incorrect' as value instead of 'i'?
I have mentioned it earlier, but the comment was buried after push --force :) -- values for the parameters being tested are more likely to be one-char length, so using the longer word we are almost guaranteed from hitting a new valid value by chance.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

args = ['-' + arg[0], val]
fname = 'test_%s_%s' % (arg[0], val)
else:
val = 'incorrect'
args = ['--' + arg, val]
fname = 'test_%s_%s' % (arg, val)

def f(self):
[msg, result] = isolate_function_error(self.stage.parse_args, args)
err = "error: argument -%s/--%s: invalid choice: '%s'" % (arg[0],
arg, val)
self.assertIn(err, msg)
setattr(ProcessorStageArgsTestCase, fname, f)


def add_mode(val, short=False):
def f(self):
if short:
Expand Down Expand Up @@ -226,6 +244,8 @@ def f(self):
add_override_hdfs(a, v)
for m in modes:
add_override_mode(a, v, m)
add_arg_incorrect(a, True)
add_arg_incorrect(a)


for m in modes:
Expand All @@ -234,6 +254,10 @@ def f(self):
add_override_hdfs_mode(m)


add_arg_incorrect('mode', True)
add_arg_incorrect('mode')


class ProcessorStageConfigArgTestCase(unittest.TestCase):
def setUp(self):
self.stage = pyDKB.dataflow.stage.ProcessorStage()
Expand Down