Skip to content

Discrepancy between test running and cleaning/printing failures #5872

Closed

Description

@stinos

The run-tests script puts the test output in the current working directory but the --print-failure and --clean-failure arguments look for test output in the tests/ directory. As a result the two only work together if the working directory for running the tests is effectively the tests/ directory. I found this out when running tests by calling run-tests by full path from wherever the cwd is: it would never print failures.

It would be better if the script would stick to one thing: either read test output from the cwd as well, or else produce it in the tests/ directory (which would be my favorite: not a fan of relying on cwd except for commandline usage). The latter could be extended by allowing to specify the output directory as an argument. Ideas of which way to go?

Activity

  1. dlech commented on Apr 6, 2020

    @dlech
    SponsorContributor

    I would be in favor of having a default output directory that is excluded from git, similar to the build directory for compiler output, e.g. tests/results/ or tests/output/.

  2. added
    testsRelates to tests/ directory in source
    on Apr 7, 2020
  3. dpgeorge commented on Apr 7, 2020

    @dpgeorge
    Member

    The latter could be extended by allowing to specify the output directory as an argument

    +1

    I would be in favor of having a default output directory that is excluded from git, similar to the build directory for compiler output, e.g. tests/results/ or tests/output/.

    +1

  4. stinos commented on Apr 7, 2020

    @stinos
    ContributorAuthor

    Note there's a similar problem with the default values of MICROPY_MICROPYTHON and MPYCROSS in run-tests: they are relative to the working directory so if you don't invoke run-tests from within it's own directory you have to specify them because the defaults are not correct anymore.

  5. stinos commented on Apr 7, 2020

    @stinos
    ContributorAuthor

    I started on this but turns out it is actually quite involved to the point I'm not sure if it's even worth it: there's really a lot of things which expect they're ran relative to the tests directory. Get a glimpse here: https://github.com/stinos/micropython/tree/run-test-abspath (note: still doesn't work). Maybe there's an easier way? But even if it would be fixed, all other test runners suffer the same problem. Perhaps just making it required for the test runners to run from the tests directory and raising an error if not would be better..

    edit Or implement it so that e.g. the problems described here (print/clean failures, specify output directory, MICROPY_MICROPYTHON etc being wrong) are fixed, but running builtin tests (i.e. anything which requires skip_tests logic and is relative to the tests directory) requires being ran from the tests directory.

  6. added a commit that references this issue on Sep 4, 2020
    916d818
  7. added a commit that references this issue on Feb 17, 2022
    bdee6cf
  8. added a commit that references this issue on Oct 11, 2025
    405893a
  9. added a commit that references this issue on May 23, 2026
    1e3f0ca
  10. added a commit that references this issue on Sep 21, 2026
    50661f8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    testsRelates to tests/ directory in source

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions