Skip to content

Commit 3a0f3d3

Browse files
committed
Updated README, streamlined tests to automatically discover new ones.
1 parent 58d3697 commit 3a0f3d3

File tree

5 files changed

+36
-52
lines changed

5 files changed

+36
-52
lines changed

README.markdown

Lines changed: 35 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,25 @@
11
RTC Python Wrapper Library
22
==========================
33

4-
WARNING: This may create a more transparent government. If you don't want change then stop reading here.
5-
6-
Update 09-20-2011
7-
------
8-
- Started cleaning up and improving the README file.
9-
10-
UPDATE 06-18-2011
11-
------
12-
Added a classmethod to query multiple bills in one request. This is very
13-
efficient for cases that require iterations through a list of bill_ids.
14-
Usage:
15-
<pre><code>
16-
bill_list = ['hr1-112', 'hr2-112']
17-
\#note: setting sections='', will request all sections for each bill
18-
bills = RTC.get_mult_bills(bill_list, sections='')
19-
</pre></code>
20-
See RTCtest.py for a full example.
4+
This is a Python wrapper for the [Sunlight Foundation's Real Time
5+
Congress API](http://services.sunlightlabs.com/docs/Real_Time_Congress_API/).
216

7+
Sunlight Labs takes government data and transforms it into services developers can use. The Real Time Congress (RTC) API is a RESTful API over the artifacts of Congress, in as close to real-time as possible.
228

9+
**WARNING**: This may create a more transparent government. If you don't want change then stop reading here.
2310

2411
Requirements
2512
------------
2613
- python >= 2.6
27-
- unittest2
28-
29-
Use the following command to clone the repository locally to work on it:
30-
<pre><code>
31-
git clone [email protected]:pythonclt/RTC-Python-Wrapper.git
32-
</pre></code>
3314

3415
List of Files
3516
-------------
3617
- README.markdown - you're reading it
3718
- requirements.txt - list of required Python packages
3819
- RTC_helpers.py - Simple file to hold help and __doc__ string text related to the RTC python library.
3920
- RTC.py - Python library for interacting with the Sunlight Labs Real Time Congress API.
40-
- RTCtest.py - Simple test file to make sure each function is working.
21+
- tests/ - Folder containing all tests (files that start with 'test_')
22+
- RTCtest.py - File demonstrating some of the API usage.
4123

4224
Example Usage
4325
-------------
@@ -55,11 +37,21 @@ bill = RTC.Bill.get_bill(bill_id)
5537
print bill['sponsor_id'], bill['vetoed'], bill['last_action']['text']
5638
</pre></code>
5739

58-
See RTCtest.py for more examples usage.
40+
See tests/RTCtest.py for more examples usage.
5941

60-
Development Notes for Contributors
42+
How to contribute
6143
----------------------------------
62-
- dict2obj is a function that coverts the json converted dictionary into a usable object. Since much of the RTC API's fields are not guaranteed, this may help avoid the extra coding for keyErrors. Additionally, it is convenient to use dot notation instead of dictionaries.
44+
45+
- Fork the project.
46+
- Read through the outstanding issues, or report new ones
47+
[here](https://github.com/pythonclt/RTC-Python-Wrapper/issues).
48+
- Write some tests to make sure we don't accidentally break your
49+
code later. We've created a [test
50+
example](https://github.com/pythonclt/RTC-Python-Wrapper/blob/master/tests/test_example.py)
51+
for you.
52+
- Enter helper text into the **RTC_helpers.py** after writing a new
53+
classmethod to help document what you've done.
54+
- Send us a pull request.
6355

6456
###How to create class methods for collections
6557
This is the basic structure:
@@ -79,25 +71,30 @@ class Bill(RTC_Client): #name of collection (eg: bills, videos, floor, updates)
7971

8072

8173
### Running tests
82-
Set your PYTHONPATH to the top-level directory--the one containing the RTC.py file. In *nix-land, do this:
74+
Make sure you have the **discover** package installed. It is included in our
75+
**requirements.txt**, which you can install with this command:
76+
8377
<code>
84-
$ export PYTHONPATH=/path/to/top/level/directory
78+
$ pip install -r requirements.txt
8579
</code>
86-
In Windows-land, do something like this:
80+
81+
Then, in the project directory you can run all the tests with:
82+
8783
<code>
88-
PYTHONPATH=%path%;\path\to\top\level\directory
84+
$ python -m discover
8985
</code>
9086

91-
You can run individual tests like this:
87+
You can run individual or grouped tests based on patterns:
9288
<code>
93-
$ python tests/TestRTC.py
89+
$ python -m discover -p 'test_videos.py'
9490
</code>
9591

96-
Also, you can run all tests like this:
92+
or
93+
9794
<code>
98-
$ python tests
95+
$ python -m discover -p '*.py'
9996
</code>
10097

101-
### Other comments
102-
- It'd be helpful to enter helper text into the RTC_helpers.py after writing a new classmethod
103-
- It'd be helpful to write some tests after writing a new classmethod. See "tests/dummy.py" to get started.
98+
### Development Notes for Contributors
99+
**dict2obj** is a function that coverts the json converted dictionary into a usable object. Since much of the RTC API's fields are not guaranteed, this may help avoid the extra coding for keyErrors. Additionally, it is convenient to use dot notation instead of dictionaries.
100+

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
unittest2
1+
discover

run_tests.sh

Lines changed: 0 additions & 2 deletions
This file was deleted.

tests/__main__.py

Lines changed: 0 additions & 11 deletions
This file was deleted.
File renamed without changes.

0 commit comments

Comments
 (0)