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

PB-974: Migration from trias to ojp for transport stop requests #4487

Conversation

rebert
Copy link
Contributor

@rebert rebert commented Nov 12, 2024

No description provided.

@ltclm ltclm changed the base branch from master to develop-2024-12-18 November 13, 2024 13:08
@github-actions github-actions bot added this to the 2024-12-18 milestone Nov 13, 2024
@hansmannj hansmannj requested a review from ltshb November 18, 2024 08:01
@hansmannj
Copy link
Member

Guess this has been moved to another PR by @rebert during deploy, when changing the base branch.

@rebert rebert marked this pull request as ready for review November 18, 2024 08:31
@rebert
Copy link
Contributor Author

rebert commented Nov 18, 2024

yes, it is not possible to merge develop towards master with open prs on develop

@hansmannj
Copy link
Member

yes, it is not possible to merge develop towards master with open prs on develop

Yes, sorry for bugging the deploy process and thanks for moving the commmits 🙏

@hansmannj hansmannj changed the base branch from develop-2024-12-18 to master November 18, 2024 09:55
@github-actions github-actions bot removed this from the 2024-12-18 milestone Nov 18, 2024
Copy link
Contributor

@ltshb ltshb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR title should be updated and CI is not passing

@hansmannj hansmannj changed the title Feat pb 974 migration from trias to ojp for transport stop requests PB-974 migration from trias to ojp for transport stop requests Nov 18, 2024
@hansmannj
Copy link
Member

hansmannj commented Nov 18, 2024

PR title should be updated and CI is not passing

Yes, need to adapt CI to use the new secrets, will hopefully find some time for that, soon.
Can you in the meantime have a look at the unit tests please? Is the mocking what you asked for in the comments in the old PR? One second please, just updating the tests. In one case, currently way too much is mocked.
Will take some time, I'll give you a ping @ltshb once I am ready.
Sorry, only noticed this now. Guess I'll only mock "send_post()"

@ltshb
Copy link
Contributor

ltshb commented Nov 19, 2024

PR title should be updated and CI is not passing

Yes, need to adapt CI to use the new secrets, will hopefully find some time for that, soon. Can you in the meantime have a look at the unit tests please? Is the mocking what you asked for in the comments in the old PR? One second please, just updating the tests. In one case, currently way too much is mocked. Will take some time, I'll give you a ping @ltshb once I am ready. Sorry, only noticed this now. Guess I'll only mock "send_post()"

Well by mocking we should not need any credential because no access to the real service should be done, unit test should not do any access to the service so they should pass even if the service is down

@hansmannj hansmannj force-pushed the feat_PB-974_migration_from_trias_to_ojp_for_transport_stop_requests branch from 054d38c to 75011f8 Compare November 19, 2024 13:47
with self.assertRaises(opentransapi.OpenTransNoStationException):
api.get_departures("invalid_id")

@patch.object(opentransapi.OpenTrans, "send_post")
Copy link
Member

@hansmannj hansmannj Nov 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this test can as well be deleted.
Here we only test, if the side_effect() works basically 😉

@hansmannj
Copy link
Member

hansmannj commented Nov 19, 2024

@rebert @ltshb : Guess now this PR is ready for review.
I tried to only mock "send_post" and condensed the tests to those that seem to make sense.
There's one left, that can be deleted, too, as it only tests an exception we provoke using side_effects().
Even better: Now the CI does not need any secrets any more, since we are mocking all requests :-)

@hansmannj hansmannj requested a review from ltshb November 19, 2024 14:14
Copy link
Contributor Author

@rebert rebert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm. but I'm not allowed to approve :-)

Copy link
Contributor

@ltshb ltshb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unittest mocking needs adaptation as well as API key need to be removed from CI

@hansmannj hansmannj force-pushed the feat_PB-974_migration_from_trias_to_ojp_for_transport_stop_requests branch 2 times, most recently from 6170a0c to 80520a9 Compare November 20, 2024 17:57
@hansmannj hansmannj requested a review from ltshb November 21, 2024 08:23
@hansmannj
Copy link
Member

Please re-check the PR.
Will prepare another PR for removing the old secrets from CI soon

@hansmannj hansmannj force-pushed the feat_PB-974_migration_from_trias_to_ojp_for_transport_stop_requests branch from 80520a9 to c8fb3c4 Compare November 21, 2024 10:24
Copy link
Contributor

@ltshb ltshb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is still some issues with the unittest in the CI

chsdi/lib/opentransapi/opentransapi.py Outdated Show resolved Hide resolved
tests/integration/test_stationboard.py Outdated Show resolved Hide resolved
tests/integration/test_stationboard.py Outdated Show resolved Hide resolved
@hansmannj hansmannj requested a review from ltshb November 21, 2024 14:21
@hansmannj
Copy link
Member

There is still some issues with the unittest in the CI

Thanks! Forgot to push the updated Pipfile(.lock), should now be fixed

Copy link
Contributor

@ltshb ltshb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks good but still have an issue with the CI

@rebert
Copy link
Contributor Author

rebert commented Dec 2, 2024

lgtm too. But I would rebase and fix the codebuild error.

@hansmannj hansmannj force-pushed the feat_PB-974_migration_from_trias_to_ojp_for_transport_stop_requests branch from 5de9dbf to d1e09e3 Compare December 2, 2024 20:24
@hansmannj hansmannj force-pushed the feat_PB-974_migration_from_trias_to_ojp_for_transport_stop_requests branch from d1e09e3 to 1ecefdc Compare December 2, 2024 20:30
@ltshb ltshb changed the title PB-974 migration from trias to ojp for transport stop requests PB-974: Migration from trias to ojp for transport stop requests Dec 3, 2024
The API we use to get time table data for open transport stops will be
decomissioned soon. Hence we migrate to OJP 2.0.
The requests to the API and the parsing of the response needed some
adaptions for that. Furthermore, the OJP 2.0 API's response sometimes
has a strange timestamp format, there are sometimes 7 instead of the
expexted 6 digits for the milliseconds. Hence a try except was used to
safely convert to the expected format in that cases.
Also some minor code clean-up was done.
@hansmannj hansmannj force-pushed the feat_PB-974_migration_from_trias_to_ojp_for_transport_stop_requests branch from 1ecefdc to 574db1a Compare December 4, 2024 10:06
@hansmannj hansmannj marked this pull request as draft December 4, 2024 10:07
@hansmannj hansmannj force-pushed the feat_PB-974_migration_from_trias_to_ojp_for_transport_stop_requests branch from 574db1a to a15b6b2 Compare December 5, 2024 12:08
Originally there were separate test files for opentransapi and the stationboard.
This is now again the case, also several test cases got lost, which were re-added
again.
Also added dependencies in order to fix
 TypeError: __init__() got an unexpected keyword argument 'management'
@hansmannj hansmannj force-pushed the feat_PB-974_migration_from_trias_to_ojp_for_transport_stop_requests branch from a15b6b2 to 57444a6 Compare December 5, 2024 14:16
@hansmannj hansmannj marked this pull request as ready for review December 5, 2024 14:27
@hansmannj hansmannj requested a review from ltshb December 5, 2024 14:27
Copy link
Member

@hansmannj hansmannj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but I am the wrong one to approve, since I cannot approve my own code 😉

@hansmannj hansmannj merged commit 3ef3f37 into master Dec 9, 2024
5 checks passed
@hansmannj hansmannj deleted the feat_PB-974_migration_from_trias_to_ojp_for_transport_stop_requests branch December 9, 2024 12:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants