-
Notifications
You must be signed in to change notification settings - Fork 82
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
Python translation #61
Conversation
on: | ||
push: | ||
paths: | ||
- 'python/**' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😎
- name: Checkout Repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Start MYSQL and import DB |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This part is just copied from the typescript version. Should probably update all the versions together?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would leave that for a separate PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(15, 35, datetime.fromisoformat('2019-02-22')), | ||
(15, 35, datetime.fromisoformat('2019-02-25')), # monday, holiday | ||
(15, 23, datetime.fromisoformat('2019-03-11')), # monday | ||
(65, 18, datetime.fromisoformat('2019-03-11')), # monday |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
did you use a coverage / mutation tool?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no I just translated the typescript tests.
sudo systemctl start mysql | ||
mysqladmin --user=${{ env.DB_USER }} --password=${{ env.DB_OLD_PASSWORD }} version | ||
mysqladmin --user=${{ env.DB_USER }} --password=${{ env.DB_OLD_PASSWORD }} password ${{ env.DB_PASSWORD }} | ||
mysql -u${{ env.DB_USER }} -p${{ env.DB_PASSWORD }} < ${GITHUB_WORKSPACE}/database/initDatabase.sql |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
like 👍🏼
mysqladmin --user=${{ env.DB_USER }} --password=${{ env.DB_OLD_PASSWORD }} password ${{ env.DB_PASSWORD }} | ||
mysql -u${{ env.DB_USER }} -p${{ env.DB_PASSWORD }} < ${GITHUB_WORKSPACE}/database/initDatabase.sql | ||
|
||
- name: Install MySQL odbc driver |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤔 other translations don't rely on odbc, is it a must?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've experimented with this alternative:
emilybache#1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I used odbc because it makes it easier to switch to a different database. It's probably not necessary here though as you point out
Emily, thank you for the translation. Looks very good. There is a small inconsistency to the other projects - because also typescript version has it.
|
|
that's because the test is spawning the app as a child process, and once the child process is terminated it stops connections (at least, I believe it does) |
Thanks @emilybache ! I tried to run this version on a macbook The slight problem is I need to adapt the install of mysql-odbc. I think @nitsanavni suggestion solves that problem. Probably also for windows. However it's not complete (still some references to pyodbc). I'd suggest
As a second step finalize @nitsanavni's contribution to make it platform independent. |
Thankyou for all your comments! I feel a bit embarrassed I forgot the readme file, sorry about that. I'll fix that and look at your other comments soon. |
No I feel embarrassed to ask you for changes. |
To answer the points from @codecop
|
OK Great @emilybache ! this works on a macbook too using the normal dependency of docker. Nice try with sql lite as well although it fails at Out of the suggestions you made nitsanavni. Is there any improvement you see still? Please to Provide a PR if so ! 👍 |
@emilybache FYI. I rewrote the test branch to alway keep the master branch mergeable into the with-tests branch. It's a convention that is useful when we make some modification to the master branche. |
Hi, Thanks Johan for fixing the git history so master can be merged into with_tests. I guess I was doing too much cherry-picking or something. As for the sqlite thing - I have this branch in my repo with a version of the production code that also works with sqlite: https://github.com/emilybache/Refactoring-Kata-Lift-Pass-Pricing/blob/with_tests_sqlite3/python/src/prices.py it's even more horrible than the original and of course doesn't match the other language versions. It is platform independent though. |
The translation is based on the typescript version. The github action runs the tests.