Skip to content

Commit 1e47496

Browse files
bottlerfacebook-github-bot
authored andcommitted
skip code tests in conda build
Summary: None of the current test_build tests make sense during `conda build`. Also remove the unnecessary dependency on the `six` library. Reviewed By: nikhilaravi Differential Revision: D20893852 fbshipit-source-id: 685f0446eaa0bd9151eeee89fc630a1ddc0252ff
1 parent 6207c35 commit 1e47496

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

packaging/pytorch3d/meta.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ requirements:
1919
run:
2020
- python
2121
- numpy >=1.11
22-
- six
2322
- torchvision >=0.5
2423
- fvcore
2524
{{ environ.get('CONDA_PYTORCH_CONSTRAINT') }}

tests/test_build.py

+6-9
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved.
2+
import os
23
import unittest
34
from collections import Counter
45
from pathlib import Path
56

67

78
# This file groups together tests which look at the code without running it.
9+
# When running the tests inside conda's build, the code is not available.
10+
in_conda_build = os.environ.get("CONDA_BUILD_STATE", "") == "TEST"
811

912

1013
class TestBuild(unittest.TestCase):
14+
@unittest.skipIf(in_conda_build, "In conda build")
1115
def test_name_clash(self):
1216
# For setup.py, all translation units need distinct names, so we
1317
# cannot have foo.cu and foo.cpp, even in different directories.
@@ -23,6 +27,7 @@ def test_name_clash(self):
2327
for k, v in counter.items():
2428
self.assertEqual(v, 1, f"Too many files with stem {k}.")
2529

30+
@unittest.skipIf(in_conda_build, "In conda build")
2631
def test_deprecated_usage(self):
2732
# Check certain expressions do not occur in the csrc code
2833
test_dir = Path(__file__).resolve().parent
@@ -44,6 +49,7 @@ def test_deprecated_usage(self):
4449
)
4550
self.assertFalse(found, msg)
4651

52+
@unittest.skipIf(in_conda_build, "In conda build")
4753
def test_copyright(self):
4854
test_dir = Path(__file__).resolve().parent
4955
root_dir = test_dir.parent
@@ -55,17 +61,8 @@ def test_copyright(self):
5561
+ " All rights reserved.\n"
5662
)
5763

58-
conda_generated_files = [
59-
"run_test.py",
60-
"run_test.sh",
61-
"conda_test_runner.sh",
62-
"conda_test_env_vars.sh",
63-
]
64-
6564
for extension in extensions:
6665
for i in root_dir.glob(f"**/*.{extension}"):
67-
if i.name in conda_generated_files:
68-
continue
6966
with open(i) as f:
7067
firstline = f.readline()
7168
if firstline.startswith(("# -*-", "#!")):

0 commit comments

Comments
 (0)