Skip to content

Commit 81a7e56

Browse files
committed
Rearranges tests
adds dockerized tests
1 parent e30ba4d commit 81a7e56

File tree

17 files changed

+60
-13
lines changed

17 files changed

+60
-13
lines changed

.coveragerc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[run]
22
branch = True
3-
source = slacktools
3+
source = src

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ matrix:
55
- python: 3.7
66
dist: xenial
77
sudo: true
8-
script: pytest && codecov
8+
script: python setup.py test && codecov
99
- python: 3.4
1010
- python: 3.5
1111
- python: 3.6
@@ -22,4 +22,4 @@ matrix:
2222
install:
2323
- pip install -r requirements-dev.txt
2424
script:
25-
- pytest
25+
- python setup.py test

Makefile

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,19 @@
1-
.PHONY: build publish test
1+
.PHONY: build publish test test-all test-%
22

33
build:
44
python setup.py sdist bdist_wheel
55

66
publish: build
77
twine upload dist/*
8+
9+
test:
10+
${MAKE} test-3.7
11+
12+
test-all:
13+
${MAKE} test-3.7
14+
${MAKE} test-3.6
15+
${MAKE} test-3.5
16+
${MAKE} test-3.4
17+
18+
test-%:
19+
docker run --rm -v $(shell pwd):/app -w /app python:$(@:test-%=%) python setup.py test

README.rst

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,20 @@ A toolbelt for working with the various `Slack APIs`_ in python.
1616
.. |Code Coverage| image:: https://codecov.io/gh/austinpray/python-slacktools/branch/master/graph/badge.svg
1717
:target: https://codecov.io/gh/austinpray/python-slacktools
1818

19+
20+
Install
21+
-------
22+
23+
Install slacktools with `PyPI <https://pypi.python.org/pypi>`_
24+
25+
.. code-block:: bash
26+
27+
pip install slacktools
28+
29+
This library is tested against Python 3.4+. `Open an issue`__ if you need this library to work on an older version.
30+
31+
__ https://github.com/austinpray/python-slacktools/issues/new
32+
1933
Features
2034
--------
2135

@@ -29,9 +43,30 @@ Features
2943
and improve testability
3044
- `Silly stuff`_
3145

32-
3346
Check out `the docs`_ for more info and `API documentation`_.
3447

48+
Tests
49+
-----
50+
51+
Running the tests is simple enough:
52+
53+
.. code-block:: bash
54+
55+
python setup.py test
56+
57+
Or just ``pytest`` will do the trick. This will run the tests in the ``tests/``
58+
directory as well as as bunch of docstring tests in the ``src/`` directory.
59+
60+
The Makefile also has some good test commands that will spin up a docker container:
61+
62+
- ``make test`` will run the tests in python 3.7.
63+
- ``make test-all`` will run a series of tests from python 3.7 down to 3.4.
64+
- ``make test-{{PY_VERSION}}`` where ``PY_VERSION`` can be `any tagged version
65+
of the official python docker image`__ will run tests under that python
66+
version. Ex: ``make test-3.5`` will run under Python 3.5.
67+
68+
__ https://hub.docker.com/_/python/
69+
3570
Roadmap
3671
-------
3772

docs/source/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
#
1515
import os
1616
import sys
17-
sys.path.insert(0, os.path.abspath('../../'))
17+
sys.path.insert(0, os.path.abspath('../../src'))
1818

1919

2020
# -- Project information -----------------------------------------------------

pytest.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[pytest]
22
addopts = --doctest-modules --cov
3-
testpaths = slacktools
3+
testpaths = src tests

requirements-dev.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
codecov
2-
pytest
3-
pytest-cov
42

53
sphinx
64
sphinx-autobuild

setup.cfg

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[aliases]
2+
test=pytest

setup.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def find_version(*file_paths):
2525

2626

2727
setup(name='slacktools',
28-
version=find_version('slacktools', 'version.py'),
28+
version=find_version('src', 'slacktools', 'version.py'),
2929
description='Toolbelt for Slack API clients for Web API and RTM API',
3030
long_description=long_description,
3131
url='https://github.com/austinpray/python-slacktools',
@@ -47,6 +47,6 @@ def find_version(*file_paths):
4747
],
4848
keywords='slack slack-web slack-rtm slacktools chat chatbots bots chatops',
4949
packages=find_packages(exclude=['docs', 'tests']),
50-
install_requires=[
51-
# ayy
52-
])
50+
setup_requires=["pytest-runner"],
51+
tests_require=["pytest", "pytest-cov"],
52+
install_requires=["typing"])

0 commit comments

Comments
 (0)