pgh-public-meetings / city-scrapers-pitt

Pittsburgh City Scrapers: sourcing public meetings in Pittsburgh
https://pgh-public-meetings.github.io/events/
MIT License
19 stars 66 forks source link

Fixing datetime mocking issue with port authority test #74

Closed wsnavely closed 4 years ago

wsnavely commented 4 years ago

And running YAPF for good measure

The port authority spider is using the self.year field from the CityScrapersSpider parent class, which is initialized based on the current date time in the CityScrapersSpider constructor. Therefore, the scraper construction needs to happen within the bounds of freezer.start()/freezer.end() in the test case in order for self.year to be affected by the mock.