Skip to content

Commit

Permalink
Create a test to ensure great samples are clean
Browse files Browse the repository at this point in the history
  • Loading branch information
laraross committed Sep 28, 2015
1 parent 88b212c commit 3f73491
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ To get this up and running as a command line utility, run `python setup.py devel

## Creating a new check
0. Pick a name for your check, e.g., `abc_checkname`.
1. Create a copy of `checks/example_check.py`, renaming it `abc_checkname.py` and placing it in `checks/`.
1. Create a copy of `checks/inprogress/example_check.py`, renaming it `abc_checkname.py` and placing it in `checks/inprogress/`.
2. Edit your check.
3. Create a new test file `test_abc_checkname.py` and place it in `tests`.
4. Run the test suite using `nosetests`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
"""
from proselint.reverse import reverse


def check(text):

reversed_text = reverse(text)
Expand Down
3 changes: 0 additions & 3 deletions test.md

This file was deleted.

1 change: 1 addition & 0 deletions tests/samples/test.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The quick brown fox jumps over the lazy dog.
20 changes: 20 additions & 0 deletions tests/test_samples.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import os
import subprocess


class TestSamples(object):

def test_samples(self):
examples_dir = os.path.join(os.getcwd(), "tests", "samples")
examples = os.listdir(examples_dir)

for example in examples:
example_path = os.path.join(examples_dir, example)
out = subprocess.check_output(
"proselint " + example_path,
shell=True)

num_errors = out.count("\n")

assert num_errors == 0, \
"{} produced {} errors.".format(example, num_errors)

0 comments on commit 3f73491

Please sign in to comment.