Closed Abeautifulsnow closed 1 week ago
@Abeautifulsnow seems like tests are failing
@Abeautifulsnow seems like tests are failing
Ummm... It seems I know where the problem lies. My two test assertions timezones are both based on Asia/Shanghai
. Then where is the timezone of the CI test environment? Or maybe I should add more code to adjust the timezone
to ensure the test passes?
Yeah, you would need to somehow modify it, so it doesn't rely on what environment it is, as github action do not give any guarantees regarding their timezones
The changes has been Done! @abondar
_____________ TestModelMethods.test_update_or_create_with_defaults _____________
[gw3] linux -- Python 3.8.18 /opt/hostedtoolcache/Python/3.8.18/x64/bin/python3.8
Traceback (most recent call last):
File "/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/unittest/case.py", line 60, in testPartExecutor
yield
File "/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/unittest/case.py", line 676, in run
self._callTestMethod(testMethod)
File "/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/unittest/async_case.py", line 65, in _callTestMethod
self._callMaybeAsync(method)
File "/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/unittest/async_case.py", line 88, in _callMaybeAsync
return self._asyncioTestLoop.run_until_complete(fut)
File "/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
return future.result()
File "/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/unittest/async_case.py", line 102, in _asyncioLoopRunner
ret = await awaitable
File "/home/runner/work/tortoise-orm/tortoise-orm/tests/test_model_methods.py", line 186, in test_update_or_create_with_defaults
await self.cls.update_or_create(id=mdl.id, defaults=mdl_dict)
File "/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/unittest/case.py", line 227, in __exit__
self._raiseFailure("{} not raised".format(exc_name))
File "/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/unittest/case.py", line 164, in _raiseFailure
raise self.test_case.failureException(msg)
AssertionError: ParamsError not raised
=========================== short test summary info ============================
FAILED tests/test_model_methods.py::TestModelMethods::test_update_or_create_with_defaults - AssertionError: ParamsError not raised
1 failed, 1102 passed, 80 skipped, 3 xfailed, 50 warnings in 58.54s
make: *** [Makefile:53: test_postgres_psycopg] Error 1
Error: Process completed with exit code 2.
It seems the issue is due to other test files, not my own. Could you please check it out? Thank you.
This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
Files with Coverage Reduction | New Missed Lines | % | ||
---|---|---|---|---|
tortoise/contrib/fastapi/init.py | 2 | 63.44% | ||
<!-- | Total: | 2 | --> |
Totals | |
---|---|
Change from base Build 9543663341: | 0.006% |
Covered Lines: | 5870 |
Relevant Lines: | 6494 |
Description
A detailed description can be found here: #1632
Motivation and Context
There are no
timezone
andutc
configurations which can be applied toRegisterTortoise
class when usingdb_url
to initialize a sql connection. I've made them available inRegisterTortoise
, allowing users to conveniently specify these settings.How Has This Been Tested?
There are no side effects on other areas of the code. It just introduces two parameters within the
RegisterTortoise
. I have tested it within my project, and it works with these settings specified. #1632And can also be tested with:
I have also added test cases for the modified parts and passed the self-test.
Checklist: