unitedstates / congressional-record

A parser for the Congressional Record.
Other
128 stars 41 forks source link

Create a single working test #2

Closed konklone closed 10 years ago

konklone commented 10 years ago

Get a micro test suite working, with just one test of one interesting example (perhaps one form of speaker name extraction).

This means that there should at least be a top-level Python function that accepts either a filename or a string, and returns a data representation of the result (in other words, doesn't just blindly write a file to disk).

The example file can be identified, copied into the repo, and referenced in the test, which sends either the filename or the contents to that Python function, and then checks to make sure the resulting parsed data has the desired results (for example, a speaker field with the correct string).

The test suite should be a single .py file with a single class and single function. One way of doing this is with unittest, which you can see in action in our bill action parser.

This test file may be worth executing indirectly, using a second file like this "run" file in unitedstates/congress, which executed the .py file and returns the 0 or 1 response code that Travis (and the terminal) look for when evaluating whether tests passed or failed.

This will also mean adding a .travis.yml file that tells Travis CI how to run our test suite, and who to email. Here's the unitedstates/congress file as an example.

The goal here is to get the full test-running process in place, before spending much time expanding the contents of the test suite itself.