congress
congress copied to clipboard
Testing Errors
When I run the tests, or anything else, I get a bunch of errors. I assume the project isn't broken. Any way that some documentation could be provided offering some troubleshooting when you're just getting up and running?
`(congress) Josephs-MacBook-Pro:congress GoldenJoe$ ./test/run ..........FFF......................EEEEEEEEWARNING:root:Using original YAML file... ..
ERROR: test_immediately_passed_bill (test_bill_history.BillHistory)
Traceback (most recent call last): File "/Users/GoldenJoe/Development/Git/congress/test/test_bill_history.py", line 51, in test_immediately_passed_bill utils.fetch_committee_names(113, {'test': True}) AttributeError: 'module' object has no attribute 'fetch_committee_names'
====================================================================== ERROR: test_introduced_bill (test_bill_history.BillHistory)
Traceback (most recent call last): File "/Users/GoldenJoe/Development/Git/congress/test/test_bill_history.py", line 33, in test_introduced_bill utils.fetch_committee_names(113, {'test': True}) AttributeError: 'module' object has no attribute 'fetch_committee_names'
====================================================================== ERROR: test_introductory_remarks_are_still_inactive (test_bill_history.BillHistory)
Traceback (most recent call last): File "/Users/GoldenJoe/Development/Git/congress/test/test_bill_history.py", line 120, in test_introductory_remarks_are_still_inactive utils.fetch_committee_names(113, {'test': True}) AttributeError: 'module' object has no attribute 'fetch_committee_names'
====================================================================== ERROR: test_normal_enacted_bill (test_bill_history.BillHistory)
Traceback (most recent call last): File "/Users/GoldenJoe/Development/Git/congress/test/test_bill_history.py", line 14, in test_normal_enacted_bill utils.fetch_committee_names(111, {'test': True}) AttributeError: 'module' object has no attribute 'fetch_committee_names'
====================================================================== ERROR: test_senate_bill_reported_nowhere (test_bill_history.BillHistory)
Traceback (most recent call last): File "/Users/GoldenJoe/Development/Git/congress/test/test_bill_history.py", line 104, in test_senate_bill_reported_nowhere utils.fetch_committee_names(111, {'test': True}) AttributeError: 'module' object has no attribute 'fetch_committee_names'
====================================================================== ERROR: test_senate_resolution_failed_voice (test_bill_history.BillHistory)
Traceback (most recent call last): File "/Users/GoldenJoe/Development/Git/congress/test/test_bill_history.py", line 69, in test_senate_resolution_failed_voice utils.fetch_committee_names(113, {'test': True}) AttributeError: 'module' object has no attribute 'fetch_committee_names'
====================================================================== ERROR: test_senate_resolution_went_nowhere (test_bill_history.BillHistory)
Traceback (most recent call last): File "/Users/GoldenJoe/Development/Git/congress/test/test_bill_history.py", line 87, in test_senate_resolution_went_nowhere utils.fetch_committee_names(113, {'test': True}) AttributeError: 'module' object has no attribute 'fetch_committee_names'
====================================================================== ERROR: test_summary (test_bill_info.BillInfo)
Traceback (most recent call last): File "/Users/GoldenJoe/Development/Git/congress/test/test_bill_info.py", line 14, in test_summary summary_text = bill_info.summary_for(bill_html)['text'] File "tasks/bill_info.py", line 183, in summary_for summaries = summaries['item'] TypeError: string indices must be integers, not str
====================================================================== FAIL: test_identify_committees (test_bill_actions.BillActions)
Traceback (most recent call last): File "/Users/GoldenJoe/Development/Git/congress/test/test_bill_actions.py", line 458, in test_identify_committees self.assertIn("committees", new_action) AssertionError: 'committees' not found in {'type': 'referral'}
====================================================================== FAIL: test_identify_committees_2 (test_bill_actions.BillActions)
Traceback (most recent call last): File "/Users/GoldenJoe/Development/Git/congress/test/test_bill_actions.py", line 469, in test_identify_committees_2 self.assertIn("committees", new_action) AssertionError: 'committees' not found in {'type': 'referral'}
====================================================================== FAIL: test_identify_committees_ambiguous (test_bill_actions.BillActions)
Traceback (most recent call last): File "/Users/GoldenJoe/Development/Git/congress/test/test_bill_actions.py", line 481, in test_identify_committees_ambiguous self.assertIn("committees", new_action) AssertionError: 'committees' not found in {'type': 'action'}
Ran 45 tests in 0.235s
FAILED (failures=3, errors=8) `
All of these tests need to be rewritten -- they can be ignored.
Okay. Just trying to run: ./run bills
produces no errors but also no saved files:
Errors for 0.
Skipped 0.
Saved data for 0.
Did you run the fdsys
task first?
Running fdsys gives me this:
Traceback (most recent call last): File "./run", line 54, in <module> import utils File "/Users/GoldenJoe/Development/Git/congress/tasks/utils.py", line 11, in <module> from pytz import timezone ImportError: No module named pytz
After pip install pytz
(and a few other things), I get this instead:
`Josephs-MacBook-Pro:congress GoldenJoe$ ./run fdsys
Downloading: https://www.gpo.gov/smap/fdsys/sitemap.xml
Traceback (most recent call last):
File "./run", line 71, in
File "/Users/GoldenJoe/Development/Git/congress/tasks/fdsys.py", line 92, in run update_sitemap_cache(options, listing)
File "/Users/GoldenJoe/Development/Git/congress/tasks/fdsys.py", line 113, in update_sitemap_cache update_sitemap(fdsys_baseurl + "fdsys/sitemap.xml", None, [], options, listing)
File "/Users/GoldenJoe/Development/Git/congress/tasks/fdsys.py", line 156, in update_sitemap 'binary': True
File "/Users/GoldenJoe/Development/Git/congress/tasks/utils.py", line 315, in download response = scraper.urlopen(url, **urlopen_kwargs)
AttributeError: 'Scraper' object has no attribute 'urlopen' `
Seems like you didn't follow the steps in the README.
Wow. Maybe you qualify that statement with something? A step you think I missed?
I think he means you need to run this before anything else
./run fdsys --collections=BILLSTATUS ./run bills
Thanks avbanks, but I was already running it. I copied and pasted directly from the readme. The errors are the same as above. Something else is definitely wrong with the way I set up the project, but it seems pretty straightforward. May just have to use an alternative solution for now.
`./run fdsys --collections=BILLSTATUS Downloading: https://www.gpo.gov/smap/fdsys/sitemap.xml Traceback (most recent call last):
File "./run", line 71, in
File "/Users/GoldenJoe/Development/Git/congress/tasks/fdsys.py", line 92, in run update_sitemap_cache(options, listing)
File "/Users/GoldenJoe/Development/Git/congress/tasks/fdsys.py", line 113, in update_sitemap_cache update_sitemap(fdsys_baseurl + "fdsys/sitemap.xml", None, [], options, listing)
File "/Users/GoldenJoe/Development/Git/congress/tasks/fdsys.py", line 156, in update_sitemap 'binary': True
File "/Users/GoldenJoe/Development/Git/congress/tasks/utils.py", line 315, in download response = scraper.urlopen(url, **urlopen_kwargs)
`
I don't know what was wrong, but I ended up getting it to work by using docker.
docker pull unitedstates/congress
And then following instructions in the docker file. I would note that you still have to run the fdsys command before fetching bills or whatever. It's easy to forget that if you go straight to the docker file.