Commit a48c33be authored by Jason Madden's avatar Jason Madden

test__issue1864.py: Disable on Python 2.7; it failed there for reasons that...

test__issue1864.py: Disable on Python 2.7; it failed there for reasons that aren't clear. I verified that Ofast or fast-math was not given. Perhaps some underlying lib had that set?

I'm not very concerned about it though.
parent c105c1b8
import sys import sys
import unittest import unittest
from gevent.testing import skipOnPy2
class TestSubnormalFloatsAreNotDisabled(unittest.TestCase): class TestSubnormalFloatsAreNotDisabled(unittest.TestCase):
"""
Enabling the -Ofast compiler flag resulted in subnormal floats getting @skipOnPy2('This test always fails on Python 2')
disabled the moment when gevent was imported. This impacted libraries
that expect subnormal floats to be enabled.
"""
def test_subnormal_is_not_zero(self): def test_subnormal_is_not_zero(self):
import gevent # Enabling the -Ofast compiler flag resulted in subnormal floats getting
# disabled the moment when gevent was imported. This impacted libraries
# that expect subnormal floats to be enabled.
#
# NOTE: This test is supposed to catch that. It doesn't seem to work perfectly, though.
# The test passes under Python 2 on macOS no matter whether -ffast-math is given or not;
# perhaps this is a difference in clang vs gcc? In contrast, the test on Python 2.7 always
# *fails* on GitHub actions (in both CPython 2.7 and PyPy). We're far past the EOL of
# Python 2.7 so I'm not going to spend much time investigating.
__import__('gevent')
# `sys.float_info.min` is the minimum representable positive normalized # `sys.float_info.min` is the minimum representable positive normalized
# float, so dividing it by two gives us a positive subnormal float, # float, so dividing it by two gives us a positive subnormal float,
# as long as subnormals floats are not disabled. # as long as subnormals floats are not disabled.
assert (sys.float_info.min / 2) > 0 self.assertGreater(sys.float_info.min / 2, 0)
if __name__ == "__main__": if __name__ == "__main__":
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment