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

tests in files? #1

Open
jankatins opened this issue Apr 28, 2015 · 1 comment
Open

tests in files? #1

jankatins opened this issue Apr 28, 2015 · 1 comment

Comments

@jankatins
Copy link

This is more like a suggestion, if you expect that there should be multiple tests and not only 5-10 per kernel.

In knitpy, I found it easier to write testcases by putting each testcase into two files, one with the input, one with the output. The actually test then looks like this:

from knitpy.tests import AbstractOutputTestCase, _add_test_cases
class OutputTestCase(AbstractOutputTestCase):
    pass
_add_test_cases(OutputTestCase, "basics")
_add_test_cases(OutputTestCase, "chunk_options")

where 'basics' and 'chunk_options' are subdirs with files in it like 'test_name.pymd' and 'test_name.md' (pymd = input, md = output, *.md is generated on first test run, but must be manually checked and the file renamed to activate the test)

Implementation is here: https://github.com/JanSchulz/knitpy/blob/master/knitpy/tests/__init__.py

I think this nicely fits here too with names like 'tab_testname.input' and 'tab_testname.output' beeing one tab completition test named 'testname' which must produce the json structure in 'tab_testname.output'.

@takluyver
Copy link
Member

For now, I'm happy with tests being defined in Python code. I think there are two many bits in the responses that can vary for a strict 'the response must be this' check to make sense. And once you start getting into defining wildcards, and ways to mark lists where the order doesn't matter, working out how to handle those things is going to be more effort than just writing bits of Python code.

Possibly we should build a framework like that later, but for now, I think it's best kept simple.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants