Skip to content

Commit

Permalink
Replace setup.py test with pytest command (google#380)
Browse files Browse the repository at this point in the history
Replace `setup.py test` with pytest command
  • Loading branch information
alldroll authored Feb 20, 2020
1 parent e6572f5 commit 413234c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,13 @@ matrix:
- echo "deb [arch=amd64] https://storage.googleapis.com/bazel-apt stable jdk1.8" | sudo tee /etc/apt/sources.list.d/bazel.list
- curl https://bazel.build/bazel-release.pub.gpg | sudo apt-key add -
- sudo apt-get update && sudo apt-get install bazel make
- sudo apt install python3-dev
- pip install -U pytest --user
script: make all

before_install:
- sudo apt install python3-dev
- pip install -U pytest --user
- go get github.com/axw/gocov/gocov
- go get github.com/mattn/goveralls
- go get github.com/fatih/color
Expand Down
7 changes: 6 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from setuptools import setup
from setuptools import Extension
from setuptools.command.build_ext import build_ext as BuildExt
from setuptools.command.test import test as TestCommand
from subprocess import Popen, PIPE

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

BuildExt.run(self)

class NoopTestCommand(TestCommand):
def __init__(self, dist):
print("_gojsonnet does not support running tests with 'python setup.py test'. Please run 'pytest'.")

jsonnet_ext = Extension(
'_gojsonnet',
sources=MODULE_SOURCES,
Expand All @@ -63,7 +68,7 @@ def run(self):
version=get_version(),
cmdclass={
'build_ext': BuildJsonnetExt,
'test': NoopTestCommand,
},
ext_modules=[jsonnet_ext],
test_suite="python._jsonnet_test",
)
4 changes: 2 additions & 2 deletions tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ then
else
c-bindings-tests/run.sh

$PYTHON_COMMAND setup.py build
$PYTHON_COMMAND setup.py test
$PYTHON_COMMAND setup.py build --build-platlib .
$PYTHON_COMMAND -m pytest python
fi

export IMPLEMENTATION=golang
Expand Down

0 comments on commit 413234c

Please sign in to comment.