Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/run_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
python -m pip install -r requirements.txt
python -m pip install -r docs/requirements.txt
python -m pip install -r requirements-tests.txt
python setup.py develop
python -m pip install -e .

- name: Run Tests
run: |
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ help:
@echo " deploy_docs to deploy the docs to Github Pages"

install:
python3 setup.py develop
python3 -m pip install -e .

test:
python3 tests.py
pytest

docs:
cd $(DOCS_DIR) ; make html
Expand Down
2 changes: 1 addition & 1 deletion requirements-tests.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ pytest==7.1.2
pytest-mock
coverage
coveralls
bokeh
bokeh>=3.0.0
nbval
pytest-cov
pygments
Expand Down
32 changes: 3 additions & 29 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import sys
from setuptools import setup
from setuptools.command.test import test as TestCommand


if sys.version_info < (3, 6):
Expand All @@ -9,47 +8,22 @@
with open('requirements.txt') as fid:
install_requires = [l.strip() for l in fid.readlines() if l]

tests_requires = [
'pytest',
'coverage',
'coveralls',
'bokeh'
]

with open('datascience/version.py') as fid:
for line in fid:
if line.startswith('__version__'):
version = line.strip().split()[-1][1:-1]
break

class PyTest(TestCommand):
user_options = [('pytest-args=', 'a', "Arguments to pass to py.test")]

def initialize_options(self):
TestCommand.initialize_options(self)
self.pytest_args = ['--nbval-lax', '--cov=datascience', 'tests']

def finalize_options(self):
TestCommand.finalize_options(self)

def pytest_collectstart(collector):
collector.skip_compare += 'text/html'

def run_tests(self):
# import here, cause outside the eggs aren't loaded
import pytest
errno = pytest.main(self.pytest_args)
sys.exit(errno)

# Test dependencies are listed in requirements-tests.txt and the test suite is
# run with pytest directly (`make test`). The `setup.py test` command was
# removed in Setuptools 72, so it is no longer wired up here.

setup(
name = 'datascience',
packages = ['datascience'],
python_requires='>=3.6',
version = version,
install_requires = install_requires,
tests_require = tests_requires,
cmdclass = {'test': PyTest},
description = 'A Jupyter notebook Python library for introductory data science',
long_description = 'A Jupyter notebook Python library for introductory data science',
author = 'John DeNero, David Culler, Alvin Wan, Sam Lau',
Expand Down
12 changes: 10 additions & 2 deletions tests.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
import pytest
"""Convenience entry point for running the test suite.

Prefer invoking ``pytest`` directly (or ``make test``). The pytest options for
this project live in the ``[pytest]`` section of ``tox.ini``, so no arguments
need to be passed here.
"""

import sys

import pytest

if __name__ == "__main__":
sys.exit(pytest.main(['--nbval-lax', '--cov=datascience', 'tests']))
sys.exit(pytest.main(sys.argv[1:]))
8 changes: 7 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,13 @@ deps =
snowballstemmer
sphinx
sphinx-rtd-theme
bokeh>=3.0.0
bokeh_sampledata


commands =
python setup.py test
pytest

[pytest]
addopts = --nbval-lax --cov=datascience
testpaths = tests