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

Add support to nose2's testsuite for defining functional tests "inline" without having to split testing information between the actual tests and the "functional/support/..." dirs #407

Open
sirosen opened this issue Aug 15, 2018 · 0 comments
Assignees

Comments

@sirosen
Copy link
Collaborator

sirosen commented Aug 15, 2018

I find it kind of annoying to write tests at present for a number of things because the test cases for functional tests need to be defined in one directory, and then invoked and worked on from elsewhere.
I don't want to remove the current mechanism, but to supplement it with something more "lightweight".

I'd like to have some testing facility in which we could do something like this in the nose2 tests:

testcase_string = ("""
import unittest

class TestCaseFoo(unittest.TestCase):
    def setUp(self):
        assert False
    def test_func1(self):
        assert True
""")
resultobj = run_testcase(['-v'], testcase_string)
assert resultobj.fail

which automatically does "the right thing".
I can further imagine run_testcase accepting content for nose2.cfg, unittest.cfg, or even a dict mapping filenames to contents.

The important improvement is that we define the behavior we expect in tests in the same location where we define the content being tested. I think this would lead to us writing more tests more easily, if it can be done well.

@sirosen sirosen self-assigned this Aug 15, 2018
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

1 participant