Skip to content

unittest.main fails to discover tests #414

Closed
@OpenBagTwo

Description

@OpenBagTwo

Running:

>>> import unittest
>>> unittest.main('my_package.tests.test_module')

results in

Ran 0 tests

OK

The workaround is to install test.support and utilize run_unittest but wow that's a lot of overhead.

The fix also appears to be to use the four-argument version of __import__:

Replace:

m = __import__(module)

with:

    m = __import__(module, None, ['object'], True)

Issue present with:

  • MicroPython
    • v1.14 on 2021-02-02; ESP module with ESP8266
    • 3d45bca-dirty on 2021-02-02; linux version
  • micropython-unittest
    • 0.3.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions