Skip to content
This repository has been archived by the owner on Feb 20, 2023. It is now read-only.

PYTHONPATH of tests is forcefully set during CMake. #1612

Open
lmwnshn opened this issue Jun 9, 2021 · 0 comments
Open

PYTHONPATH of tests is forcefully set during CMake. #1612

lmwnshn opened this issue Jun 9, 2021 · 0 comments
Labels
best-practice Style fixes or refactor in the code base. Mark issues with this.

Comments

@lmwnshn
Copy link
Contributor

lmwnshn commented Jun 9, 2021

Documentation

PYTHONPATH of tests is forcefully set during CMake.

Summary

ctest does not seem to pass environment variables through to the tests that it invokes.

For an example of where this fails, consider

PYTHONPATH=.. ninja self_driving_e2e_test

where self_driving_e2e_test will invoke model_server_test.

The PYTHONPATH has to be specified because we are using relative imports in model_server.py.
We must use relative imports in model_server.py because we are relying on Python's import cache to simulate having a global importable singleton.
So the proper invocation has to be something like, from a typical build folder,

PYTHONPATH=.. ./test/model_server_test

Attempted fixes that I have tried include

  1. export PYTHONPATH=.. before running ninja self_driving_e2e_test
  2. PYTHONPATH=.. ninja self_driving_e2e_test

We can fix this in CMake per #1611, but it is a bit unexpected/surprising.
I don't know how you would fix it otherwise.

@lmwnshn lmwnshn added the best-practice Style fixes or refactor in the code base. Mark issues with this. label Jun 9, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
best-practice Style fixes or refactor in the code base. Mark issues with this.
Projects
None yet
Development

No branches or pull requests

1 participant