Skip to content
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

tsc imports script modules from strange locations #45

Open
behrisch opened this issue Jul 27, 2022 · 1 comment
Open

tsc imports script modules from strange locations #45

behrisch opened this issue Jul 27, 2022 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@behrisch
Copy link
Contributor

the tests import from files which are installed in the repo root

@behrisch behrisch added the bug Something isn't working label Jul 27, 2022
@behrisch behrisch self-assigned this Jul 27, 2022
@behrisch
Copy link
Contributor Author

This seems to be harder than anticipated. The root dir of the repo is always at the begin of sys.path if you start tsc_main.py so if the user decides to run install_scenario_templates.py right there (which is currently encouraged by the docs) the import of the user installed scenario_templates will always come before the scenario_templates of the test. I see hree options:

  • move the python scripts to a src dir such that the repo root dir is not automatically added to sys.path
    • con: violates repo structure assumptions for python projects
    • pro: gives better separation of code and data
  • use a different name for the scenario_template dir in the tests
    • con: introduces an artificial difference between test environment and "production"
    • pro: easily done
  • insert an entry at the front of sys.path when modifying it in tsc_main
    • con: may not help at all if there is no scripting module
    • pro: is a one-liner

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant