Commit 42e7de41 authored by Jeremy Reizenstein's avatar Jeremy Reizenstein Committed by Facebook GitHub Bot
Browse files

fix test_build internal

Summary: Make test work in isolation, and when run internally make it not try the sqlalchemy files.

Reviewed By: shapovalov

Differential Revision: D46352513

fbshipit-source-id: 7417a25d7a5347d937631c9f56ae4e3242dd622e
parent 88429853
......@@ -5,6 +5,7 @@
# LICENSE file in the root directory of this source tree.
import importlib
import os
import sys
import unittest
import unittest.mock
......@@ -25,16 +26,23 @@ class TestBuild(unittest.TestCase):
if module.startswith("pytorch3d"):
sys.modules.pop(module, None)
# torchvision seems to cause problems if re-imported,
# so make sure it has been imported here.
import torchvision.utils # noqa
root_dir = get_pytorch3d_dir() / "pytorch3d"
# Exclude opengl-related files, as Implicitron is decoupled from opengl
# components which will not work without adding a dep on pytorch3d_opengl.
ignored_modules = (
"__init__",
"plotly_vis",
"opengl_utils",
"rasterizer_opengl",
)
if os.environ.get("FB_TEST", False):
ignored_modules += ("orm_types", "sql_dataset", "sql_dataset_provider")
for module_file in root_dir.glob("**/*.py"):
if module_file.stem in (
"__init__",
"plotly_vis",
"opengl_utils",
"rasterizer_opengl",
):
if module_file.stem in ignored_modules:
continue
relative_module = str(module_file.relative_to(root_dir))[:-3]
module = "pytorch3d." + relative_module.replace("/", ".")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment