-
Notifications
You must be signed in to change notification settings - Fork 134
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
Fixed testSetups/testTeardowns not being run for parent layers in Such #211
Conversation
What about class setUp and tearDown? |
This test "higher_layer_setup.py" is checking the behaviour of setUp, which is only called once per layer. I assumed this was correct. |
Nope. Both test_setup and setup should be called once for each layer. |
OK, but then what's the difference between test_setup and setup? On Wed, Jul 2, 2014 at 4:28 PM, Omer Katz notifications@github.com wrote:
Aloys Baillet |
setup runs once for each layer. test_setup runs once for each test. |
To eliminate any doubt, could you update this code to show exactly what you expect to happen? import logging
log = logging.getLogger(__name__)
from nose2.tools import such
with such.A('foo') as it:
it.upper_run = 0
it.lower_run = 0
@it.has_setup
def upper_test_setup(case):
log.error('foo::setUp')
it.upper_run += 1
with it.having('some bar'):
@it.has_setup
def lower_test_setup(case):
log.error('foo some bar::setUp')
it.lower_run += 1
@it.should("run all setups")
def test_run_all_setups(case):
case.assertEquals(it.upper_run, 1)
case.assertEquals(it.lower_run, 1)
@it.should("run all setups just once")
def test_run_all_setups_just_once(case):
case.assertEquals(it.upper_run, 1)
case.assertEquals(it.lower_run, 1)
it.createTests(globals()) |
That's exactly what should happen. |
Good news: that's one of the new tests in the PR:-)
|
So this is mergeable? :) |
Good question :-) I would think so, as it doesn't break anything and adds a On Thu, Jul 3, 2014 at 9:05 AM, Omer Katz notifications@github.com wrote:
Aloys Baillet |
Fixed testSetups/testTeardowns not being run for parent layers in Such
It took a little while, but I think this is right...
Fixes #127