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

beforeEach and afterEach don't apply to nested test cases #22

Open
Mimickal opened this issue May 26, 2019 · 1 comment
Open

beforeEach and afterEach don't apply to nested test cases #22

Mimickal opened this issue May 26, 2019 · 1 comment
Assignees

Comments

@Mimickal
Copy link

Mocha in Node.js would run this outer beforeEach function before all tests that occur within the top-level describe block, including those nested within inner describe blocks. Pocha does not apply the beforeEach to the test cases within inner describe blocks.

This code demonstrates this behavior. Note that "before each" is printed only once, showing that it was not run for "inner test":

from pocha import describe, beforeEach, it

@describe('tests')
def tests():
    @beforeEach
    def before():
        print('before each')

    @it('outer')
    def outer():
         print('outer')

    @describe('inner')
    def inner():

        @it('inner test')
        def inner_test():
            print('inner test')

outputs

  tests
before each
outer
    ✓ outer
    inner
inner test
        ✓ inner test
@rlgomes
Copy link
Owner

rlgomes commented May 29, 2019

@Mimickal nice catch I think its worth fixing for consistency sake

@rlgomes rlgomes self-assigned this May 29, 2019
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