Skip to content

Tests silently consume AssertionError in Python #13

@FArekkusu

Description

@FArekkusu

AssertionError doesn't show up in the output when it's raised inside a function decorated by test.describe, test.it, or inside any function called by those. It correctly stops the execution, emits a non-zero exit code, and results in a test failure, but there's no error message. The issue is present both in Python 3.6 and Python 3.8.


This works:

import codewars_test as test

assert 0

@test.describe("T")
def _():
    @test.it("t")
    def _():
        test.pass_()

image


While any of these doesn't:

import codewars_test as test

@test.describe("T")
def _():
    
    assert 0
    
    @test.it("t")
    def _():
        test.pass_()
import codewars_test as test

@test.it("t")
def _():
    assert 0
    test.pass_()
import codewars_test as test

# whether this is defined in the test file or imported from the solution doesn't matter
def f():
    assert 0

@test.it("t")
def _():
    f()
    test.pass_()

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions