Skip to content
This repository has been archived by the owner on Jul 10, 2023. It is now read-only.

Commit

Permalink
Merge pull request #432 from zdict/issue-428
Browse files Browse the repository at this point in the history
  • Loading branch information
Frank Jheng committed Jun 2, 2020
2 parents d2ea4fd + 95e7592 commit f8456d6
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 31 deletions.
4 changes: 2 additions & 2 deletions .circleci/config.yml
@@ -1,4 +1,4 @@
# eython CircleCI 2.0 configuration file
# Python CircleCI 2.0 configuration file
#
# Check https://circleci.com/docs/2.0/language-python/ for more details
#
Expand Down Expand Up @@ -72,7 +72,7 @@ variables:
name: run tests
command: |
. venv/bin/activate
python setup.py test
make test
- store_test_results:
path: test-reports
Expand Down
10 changes: 9 additions & 1 deletion .travis.yml
Expand Up @@ -39,7 +39,15 @@ install:
- pip freeze

script:
- python setup.py test
- pip install -r requirements-test.txt
- make test

before_cache:
# Remove __pycahce__ dirs and *.pyc, *.pyo files before uploading cache.
# Which will changes between every single builds.
# This could make Travis CI don't upload cache every time.
- python3 -Bc "import pathlib; [p.unlink() for p in pathlib.Path('$HOME/venv').rglob('*.py[co]')]"
- python3 -Bc "import pathlib; [p.rmdir() for p in pathlib.Path('$HOME/venv').rglob('__pycache__')]"

after_success:
- coveralls
Expand Down
5 changes: 4 additions & 1 deletion Makefile
Expand Up @@ -27,7 +27,10 @@ clean: clean-pyc clean-vim-swap-files
rm -rf build dist htmlcov .coverage* .cache .eggs

test:
python setup.py test
py.test

test-with-pdb:
py.test --pdb

# Make docker-zdict don't complain about no make rules for apple, bird, ...
%:
Expand Down
15 changes: 9 additions & 6 deletions README.rst
Expand Up @@ -228,17 +228,20 @@ If you use `virtualenv`, you may want to create a new enviroment for `zdict`::

Once you installed it with the command above,
just execute `zdict` after modification.
Don't need to install it again.
No need to install it again.

We use ``py.test``::
Install the packages for testing::

$ pip install pytest pytest-cov coverage
$ python setup.py test

or::
We use ``py.test``::

$ py.test

or::

$ make test

After runing testing, we will get a coverage report in html.
We can browse around it::

Expand All @@ -254,11 +257,11 @@ Debugging

``py.test`` can prompt ``pdb`` shell when your test case failed::

$ python setup.py test -a "--pdb"
$ py.test --pdb

or::

$ py.test --pdb
$ make test-with-pdb


Bug Report
Expand Down
21 changes: 0 additions & 21 deletions setup.py
Expand Up @@ -2,7 +2,6 @@
import os

from setuptools import find_packages, setup
from setuptools.command.test import test as TestCommand


ROOT_DIR = os.path.dirname(os.path.realpath(__file__))
Expand Down Expand Up @@ -40,25 +39,6 @@ def get_test_req():
version = get_zdict_version()


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 = []

def finalize_options(self):
TestCommand.finalize_options(self)
self.test_args = []
self.test_suite = True

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


install_requirements = parse_requirements(
os.path.join(ROOT_DIR, 'requirements.txt')
)
Expand All @@ -72,7 +52,6 @@ def run_tests(self):
scripts=['scripts/zdict'],
install_requires=install_requirements,
tests_require=get_test_req(),
cmdclass={'test': PyTest},

name='zdict',
version=version,
Expand Down

0 comments on commit f8456d6

Please sign in to comment.