Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add fake server & basic tests against it #45

Closed
wants to merge 9 commits into from

Conversation

ezheidtmann
Copy link

Not ready to merge! Need guidance on the following details:

  • Should additional dependencies be added to setup.py?
  • How would you like to include dependences for testing, such as requests_mock?
  • Can test discovery be done better?

Tests can be run with python -m unittest discover mds.tests, from the repo root.

This PR adds the following:

  • A small Flask server implementing trips and status_changes endpoints with fixed object lists, with partial support for filters and pagination
  • A GET-only adapter between requests_mock and a flask app
  • An API test case which uses the Flask app & mock adapter to check the depagination support in ProviderClient

@thekaveman
Copy link
Contributor

This is really cool! Thank you for your efforts @ezheidtmann.

Regarding your points of clarification: #15 was more of a "cry for help" from me, as I have very little (read: none) experience with writing tests for Python projects.

Tagging @hunterowens @ian-r-rose who may be able to weigh in with their thoughts. I am open to whatever best-practices or standard approaches there are to the questions above.

@ezheidtmann
Copy link
Author

Great. I've usually added tests either to an existing project or within Django, with has an opinionated approach and a custom test runner, so I'm not an expert on the Python community customs here.

@thekaveman
Copy link
Contributor

Tagging @johnclary as well, since he seems to have a ton of Python experience (yes, I stalked your profile John!)

thekaveman and others added 6 commits December 5, 2018 09:21
* Convert shapely to geojson dict

* minor import cleanups

* removing geopandas install_requires
A little refactoring to allow consumers to iterate pages from each
provider.  Intention is to maintain ProviderClient behavior except for
these changes:

 - don't request a second page if the first page is empty (previously
   would have made a second request if `next_url` was present on first
   page)
 - don't return any results for a provider if any pages failed
   (previously would have returned partial results if a page other than
   the first failed)
@ezheidtmann
Copy link
Author

ezheidtmann commented Dec 12, 2018

Rebased on #46 and dev branch. Added more features to server.

@ezheidtmann
Copy link
Author

ezheidtmann commented Dec 13, 2018

Just pushed 1) changes to ProviderClient to emphasize iteration, and 2) a test for the non-overlapping trips query problem. Related to #46

@ezheidtmann ezheidtmann mentioned this pull request Dec 13, 2018
3 tasks
@thekaveman thekaveman changed the base branch from dev to master December 31, 2018 19:23
@thekaveman
Copy link
Contributor

Hey @ezheidtmann... i made some comments over in your other #46.

The latest release has evolved this library and taken into consideration many of the points you made over these PR conversations, so thank you. Closing this PR but would welcome new work on top of master.

@thekaveman thekaveman closed this Aug 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants