Skip to content

Commit

Permalink
tox.ini: configure and run tox
Browse files Browse the repository at this point in the history
This PR adds tox.ini to enable tox which is the recommened
way of testing. This will allow a user to run the tests
before submitting the PR.
The documentation has also been updated to show how to
run tox.
The tox requirement has been added to setup.cfg
Also formatted .circleci/config.yml and
.github/workflows/pull_request.yml to remove
extra newlines and spaces.

Signed-off-by: PrajwalM2212 <[email protected]>
  • Loading branch information
PrajwalM2212 authored and Nisha K committed Feb 28, 2020
1 parent 3dbd5a0 commit 1780b71
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 5 deletions.
1 change: 0 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,3 @@ workflows:
- security
- test_changes
- test_coverage

6 changes: 3 additions & 3 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ jobs:
c=`python ci/evaluate_docs.py`; if [ -z $c ]; then echo "No .py files to lint"; else echo $c | xargs prospector; fi
- name: Commit Message Linting
if: always() # run even if above step fails
run: python ci/test_commit_message.py
run: python ci/test_commit_message.py
- name: Security Linting
if: always() # run even if above step fails
if: always() # run even if above step fails
run: |
pip install bandit~=1.6
c=`python ci/evaluate_docs.py`; if [ -z $c ]; then echo "No .py files to lint"; else echo $c | xargs bandit; fi
- name: Test Changes
if: always() # run even if above step fails
if: always() # run even if above step fails
run: python ci/test_files_touched.py
- name: Test Coverage
if: always() # run even if above step fails
Expand Down
3 changes: 3 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,9 @@ This will install tern in development mode on windows and mac.
4. Fix any issues bandit brings up.
5. Test your changes.

### Testing you changes
After you make the changes just run `tox`. This will run a set tests and inform you if anything is wrong.

## Coding Style

Tern follows general [PEP8](https://www.python.org/dev/peps/pep-0008/) style guidelines. Apart from that, these specific rules apply:
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,4 @@ console_scripts =
tern = tern.__main__:main

[options.extras_require]
dev = bandit~=1.6; prospector>=1.2; GitPython~=2.1
dev = bandit~=1.6; prospector>=1.2; GitPython~=2.1; tox>=3.14
38 changes: 38 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
[tox]
envlist = py35
py36
py37
commit
prospector
security
changes
coverage

[testenv]
description = Run tests
deps = GitPython~=2.1

[testenv:prospector]
description = Run the Prospector test
deps = prospector>=1.2
commands = prospector

[testenv:commit]
description = Run the Commit test
commands = python ci/test_commit_message.py

[testenv:security]
description = Run bandit
deps = bandit~=1.6
commands = bandit .

[testenv:tests]
description = Run unittests
commands = python -m unittest discover -s tests

[testenv:coverage]
description = Get current coverage
deps = coverage
commands = coverage run -m unittest discover -s tests
coverage report --omit .tox/**,tests/**

0 comments on commit 1780b71

Please sign in to comment.