Skip to content

unittest.main fails to discover tests #414

@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

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy