Skip to content

Commit 413234c

Browse files
authored
Replace setup.py test with pytest command (google#380)
Replace `setup.py test` with pytest command
1 parent e6572f5 commit 413234c

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

.travis.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,13 @@ matrix:
3939
- echo "deb [arch=amd64] https://storage.googleapis.com/bazel-apt stable jdk1.8" | sudo tee /etc/apt/sources.list.d/bazel.list
4040
- curl https://bazel.build/bazel-release.pub.gpg | sudo apt-key add -
4141
- sudo apt-get update && sudo apt-get install bazel make
42+
- sudo apt install python3-dev
43+
- pip install -U pytest --user
4244
script: make all
4345

4446
before_install:
4547
- sudo apt install python3-dev
48+
- pip install -U pytest --user
4649
- go get github.com/axw/gocov/gocov
4750
- go get github.com/mattn/goveralls
4851
- go get github.com/fatih/color

setup.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
from setuptools import setup
1717
from setuptools import Extension
1818
from setuptools.command.build_ext import build_ext as BuildExt
19+
from setuptools.command.test import test as TestCommand
1920
from subprocess import Popen, PIPE
2021

2122
DIR = os.path.abspath(os.path.dirname(__file__))
@@ -45,6 +46,10 @@ def run(self):
4546

4647
BuildExt.run(self)
4748

49+
class NoopTestCommand(TestCommand):
50+
def __init__(self, dist):
51+
print("_gojsonnet does not support running tests with 'python setup.py test'. Please run 'pytest'.")
52+
4853
jsonnet_ext = Extension(
4954
'_gojsonnet',
5055
sources=MODULE_SOURCES,
@@ -63,7 +68,7 @@ def run(self):
6368
version=get_version(),
6469
cmdclass={
6570
'build_ext': BuildJsonnetExt,
71+
'test': NoopTestCommand,
6672
},
6773
ext_modules=[jsonnet_ext],
68-
test_suite="python._jsonnet_test",
6974
)

tests.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ then
1414
else
1515
c-bindings-tests/run.sh
1616

17-
$PYTHON_COMMAND setup.py build
18-
$PYTHON_COMMAND setup.py test
17+
$PYTHON_COMMAND setup.py build --build-platlib .
18+
$PYTHON_COMMAND -m pytest python
1919
fi
2020

2121
export IMPLEMENTATION=golang

0 commit comments

Comments
 (0)