Closed Jason-Ku closed 4 years ago
added mock
into the pipenv Pipfile
and got similar results
@Jason-Ku Do you know what the warning is about?
Could it be resolved by defining TestEntity
within the tests/test_database_wrapper.py
file?
After all, it would make maintaining the test_database_wrapper
a lot easier in the future if the entity is in the same file.
@Jason-Ku Do you know what the warning is about?
Could it be resolved by defining
TestEntity
within thetests/test_database_wrapper.py
file?After all, it would make maintaining the
test_database_wrapper
a lot easier in the future if the entity is in the same file.![]()
I think it's because pytest skips any class that starts with "test", and raises an error even though its totally fine.
That leads me to believe that including the TestEntity class would in test_database_wrapper might not solve the issue, but it's worth a shot and I agree that it would make things easier. An alternative I just found would be to add test = False as an attribute of TestEntity and it'll ignore it and not raise the error you're seeing.
The last approach which I don't recommend and am not even sure if it will work, would be to rename TestEntity
to not have the word "test" in it, but that would make things pretty confusing, huh?
Removed all the junk from the database_wrapper.py main method, shouldn't need it anymore now that we have tests, I hope. If theres a case for keeping it there, we can add it back.
Here's a quick case for keeping it there:
if __name__ == "__main__"
serves as a super quick and easy documentation of a module for anyone browsing thorugh the code. (althought it's no substitute for docstrings)if __name__ == "__main__"
serves as an easy way for people to test quick changesif __name__ == "__main__"
is ignored when the module is imported However, I won't miss it much considering you converted the code into test cases! 😄
The last approach which I don't recommend and am not even sure if it will work, would be to rename
TestEntity
to not have the word "test" in it, but that would make things pretty confusing, huh?
@Jason-Ku
What if we called it MockEntity
?
Would that be a good middle ground?
The last approach which I don't recommend and am not even sure if it will work, would be to rename
TestEntity
to not have the word "test" in it, but that would make things pretty confusing, huh?@Jason-Ku What if we called it
MockEntity
?Would that be a good middle ground?
I totally forgot about prefixing things with Mock - yeah I'll try that!
EDIT: It works. I'll update this pr!
What's New?
_execute
function inNimbusMySQLAlchemy
), let me know if this going to be used, we can add it back.How Has This Been Tested?
Checklist (check-all-before-merge)
formatting help:
- [x]
means "checked' and- [ ]
means "unchecked"[ ] I documented my code according to the Google Python Style Guide
[ ] I ran
./build_docs.sh
and the docs look fine[ ] I ran
./type_check.sh
and got no errors[ ] I ran
./format.sh
because it automatically cleans my code for me 😄[ ] I ran
./lint.sh
to check for what "format" missed[x] I added my tests to the
/tests
directory[x] I ran
./run_tests.sh
and all the tests pass