-
-
Notifications
You must be signed in to change notification settings - Fork 8.2k
tests/run-tests: Run tests inside a temporary chdir. #6909
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
Conversation
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
812e25f
to
71d0814
Compare
Updated to use a unique temp dir per invocaton. This is to allow copying required data files into the test dir. Any test in a directory that has a "data" directory will have this copied into the working dir. |
71d0814
to
8b6310a
Compare
Any required data files are copied into the working dir. This prevents "import foo" from finding tests/foo, for example "io". Individual tests could previously work around this by importing "uio" instead, but tests can now depend on other libraries (e.g. uasyncio). Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
8b6310a
to
831d0c0
Compare
def base_path(*p): | ||
return os.path.abspath(os.path.join(BASEPATH, *p)).replace('\\', '/') | ||
return os.path.abspath(os.path.join(BASEPATH, *p)).replace("\\", "/") | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you add these newlines, or black
? (just wondering)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
black
-- The first commit is entirely black's changes (nothing from me).
The underlying issue here was that run-tests.py used to do: os.environ["MICROPYPATH"] = os.pathsep + base_path("../extmod") which was intended to make it possible to import frozen modules (and extmod modules), but had the additional undesirable effect of including TOP/tests in the module search path. But now #8079 allows us to specifically add frozen modules to the path without using |
…unneeded-code Remove unneeded workaround for Feather ESP32-S2 TFT
I think this is a good idea just for making sure the tests run in a self-contained environment, and possibly we should consider a unique temp dir per test invocation.
However, this is specifically to workaround a situation where I want to write a test for uasyncio (#6885), where uasyncio now does "import io", but this ends up importing tests/io instead.
I've tried to ensure that this doesn't break anything from #5877 (@stinos ), and in particular that running this from a out-of-tree directory continues to work.