mentorship-backend icon indicating copy to clipboard operation
mentorship-backend copied to clipboard

OSError in Windows not being caught

Open sumit-badsara opened this issue 5 years ago • 9 comments

Describe the bug

When there is some invalid argument, we expect it to be caught by python under ValueError. But In the case of passing invalid timestamp in test test_dao_create_mentorship_relation_with_good_args_but_invalid_timestamp. It get's caught on other OS, but for Windows It throws OSError (Another Exception) which is not getting caught by ValueError.

To Reproduce (Steps for windows only)

  1. Run python unittests (there should be one test failure)
  2. See the error

Expected behavior The test should pass and no test should have been failed.

Screenshots image

Desktop (please complete the following information):

  • OS: Windows

sumit-badsara avatar May 29 '20 21:05 sumit-badsara

Hi @anitab-org/mentorship-managers , please have a look at this issue I'm facing some issue while checking it out on my laptop

adi-001 avatar Jun 03 '20 21:06 adi-001

@isabelcosta I would like to work on this issue!

sumit-badsara avatar Jun 03 '20 22:06 sumit-badsara

@BadduCoder I have assigned you, let me know if you have any questions.

SanketDG avatar Jun 03 '20 22:06 SanketDG

Hey @BadduCoder , what's the status for your PR?

adi-001 avatar Jun 17 '20 18:06 adi-001

@adi-001 You can work on this issue if you want, I am pretty busy with multiple things on my hand.

sumit-badsara avatar Jun 24 '20 04:06 sumit-badsara

@devkapilbansal @gaurivn can you reproduce this issue locally , I don't get this error .

vj-codes avatar Mar 27 '21 13:03 vj-codes

Closing as the issue no longer exists

vj-codes avatar Apr 02 '21 06:04 vj-codes

Reopening as the error still exists 👀

vj-codes avatar Apr 02 '21 06:04 vj-codes

Thank you @vj-codes for reopening this ticket after spotting this issue 💪🏾 I took a brief look at the PR https://github.com/anitab-org/mentorship-backend/pull/621 which was closed and it was almost there, it just needed a few changes.

Also looking at https://docs.python.org/3/library/datetime.html#datetime.date.fromtimestamp, I noticed that after python 3.3, this function throws either OverflowError or OSError, so I guess ValueError does not make sense at this time we are using python 3 > 3.3.

I'll leave it to the contributor who works on this to lead the implementation :)

cc @anitab-org/mentorship-maintainers

isabelcosta avatar Jul 10 '21 13:07 isabelcosta