databricks / mlops-stacks

This repo provides a customizable stack for starting new ML projects on Databricks that follow production best-practices out of the box.
https://docs.databricks.com/en/dev-tools/bundles/mlops-stacks.html
Apache License 2.0
425 stars 143 forks source link

Move pytest root to the internal project directory #74

Closed mingyu89 closed 1 year ago

mingyu89 commented 1 year ago

When monorepo is used and there are more than 2 projects, pytest complains that

import file mismatch:
imported module 'tests.training.test_notebooks' has this __file__ attribute:
  /Users/mingyu.li/mlops-azure-cuj/mlops-azure-cuj/tests/training/test_notebooks.py
which is not the same as the test file we want to collect:
  /Users/mingyu.li/mlops-azure-cuj/unified-run-modes-fs/tests/training/test_notebooks.py
HINT: remove __pycache__ / .pyc files and/or use a unique basename for your test file modules

This is happening because the test files have the same name in two or more different directories. To resolve it, we want to use the internal project directory as the pytest root directory.


Covered by existing unit tests.