-
Notifications
You must be signed in to change notification settings - Fork 324
Test fixes #524
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
Test fixes #524
Conversation
69b8288 to
f42d43d
Compare
| from __future__ import division, print_function | ||
|
|
||
| VERSION = (2, 1, 3, 'dev') | ||
| __version__ = ''.join(['-.'[type(x) == int]+str(x) for x in VERSION])[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.
version 1.2.3-dev0 is normalized to 1.2.3.dev0
| py37 | ||
| py38 | ||
| pypy | ||
| envlist = py3{6,7,8,9,10,11},pypy3 |
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.
use compact form
| def test_coroutine_error(self): | ||
| evl = self.evl | ||
|
|
||
| async def error_coro(): |
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 syntax is not supported on python2.
Since sunset of python2, no reason to add magic with compile
|
|
||
| async def error_coro(): | ||
| result = 1 / 0 # Simulate error in coroutine | ||
| yield result |
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.
yield -> async generator, we need coroutine
| trio | ||
|
|
||
| commands = | ||
| coverage run -m unittest discover -s urwid -v |
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.
need to check GitHub on separate branch before apply to pipeline
| >>> e.keypress(size, '5') | ||
| >>> e.keypress(size, '1') | ||
| >>> assert e.value() == Decimal("51.51") | ||
| >>> assert e.value() == Decimal("51.51"), e.value() |
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.
during tests e.value() is not visible in error without explicit add as message
* asyncio coroutine was not awaited, so test was false-positive (poor visible on Travis CI)
Fix test.
* FloatEdit unittests passed, incorrect output doctests not caused exception on CI
* warnings on version number
* warnings about deprecated setup.py usage for tests run
* python2.7 is not able to execute tests for asyncio due to mandatory syntax changes (async def).
Fix logic:
1. added `isinstance` check before getting significance
2. Fix FloatEdit and add corner case tests
3. normalize version number
4. execute tests via `unittest`
5. stop using python 2.7 in tests run instead of increasing complexity
f42d43d to
e2bfb61
Compare
| self._decimalSeparator, '.')) * 1 | ||
| normalized = Decimal(self.edit_text.replace(self._decimalSeparator, '.')) | ||
| if self.significance is not None: | ||
| return normalized.quantize(self.significance) |
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.
https://docs.python.org/3/library/decimal.html#decimal.Decimal.quantize should be enough without context magic and manual calculation
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.
Not to mention I somehow wasn't using the context anyway...
And made the same mistake in the test case (facepalm).
This is a nice clean alternative.
|
Tests green. |
isinstancecheck before getting significance 2. in case of using points after delimiter, need + 2 to precision 3. properly set precision to context instead of context override 4. normalize version number 5. execute tests viaunittest6. stop using python 2.7 in tests run instead of increasing complexityChecklist
masterorpython-dual-supportbranchtoxsuccessfully in local environment