-
Notifications
You must be signed in to change notification settings - Fork 431
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
Update cython bindings for python 3.6 and 2.7. Updated Tests. #23
Conversation
Thanks @ezietsman. Do these changes mean both python 2.x and 3.x are now supported or just python 3.x? In terms of the AppVeyor build for Windows at the moment our AppVeyor build uses the Visual Studio project file and not CMake which means the python API wrapper isn't built and the python tests aren't run. |
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.
Thanks @ezietsman for the patch.
I noticed that you disabled fpectl
, I guess this is due to the problem you reported in #20. However I would prefer very much that we fix the build of fpectl
on Mac OSX rather than disabling it altogether.
tests/CheckScripts.py
Outdated
from JSBSim_utils import JSBSimTestCase, CreateFDM, RunTest, ExecuteUntil | ||
|
||
|
||
class CheckScripts(JSBSimTestCase): | ||
def testScripts(self): | ||
fpectl.turnon_sigfpe() |
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.
The module fpectl
is there to check that JSBSim does not raise floating point exceptions. There has been such issues in the past and this check is there to make sure there are no regressions. As such fpectl
must not be disabled.
tests/TestLGearSteer.py
Outdated
gear = grndreact.get_gear_unit(i) | ||
self.assertEqual(gear.get_steer_norm(), 0.0) | ||
|
||
fpectl.turnoff_sigfpe() |
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.
Same comment as for CheckScripts.py
, the module fpectl
is used for regression tests. It must not be disabled.
tests/setup.py.in
Outdated
# sources=[os.path.join('${CMAKE_SOURCE_DIR}', | ||
# 'tests', | ||
# 'fpectlmodule.cpp')], | ||
# language='c++')]) |
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.
Same as previously, the module fpectl
is used for regression tests and must not be disabled.
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.
@ezietsman
When I tested your code, I discovered that TestInputSocket
was failing while it did not before on my system. After some investigations, I found that some of your modifications were incorrect. I have submitted some proposals to fix that. Could you please review and include them to your patch ?
tests/TestInputSocket.py
Outdated
['get', 'help', 'hold', 'info', 'iterate', 'quit', 'resume', 'set']) | ||
self.assertEqual(sorted(map(lambda x: x.split('{').strip()[0]), | ||
_tn.sendCommand("help").split('\n')[2:-2]), | ||
['get', 'help', 'hold', 'info', 'iterate', 'quit', 'resume', 'set']) |
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.
According to my tests, this code has been incorrectly modified. It should rather be
self.assertEqual(sorted(map(lambda x: x.split('{')[0].strip(),
_tn.sendCommand("help").split('\n')[2:-2])),
['get', 'help', 'hold', 'info', 'iterate', 'quit', 'resume', 'set'])
Otherwise the test fails.
tests/TestInputSocket.py
Outdated
self.assertEqual(msg[2].split(':')[1], | ||
root.attrib['name'].strip()) | ||
self.assertEqual(msg[1].split(':')[1], | ||
root.attrib['version'].strip()) |
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.
According to my tests, this code has been incorrectly modified. It should rather be
self.assertEqual(msg[2].split(':')[1].strip(),
root.attrib['name'].strip())
self.assertEqual(msg[1].split(':')[1].strip(),
root.attrib['version'].strip())
Otherwise the test fails.
@seanmcleod I have tested successfully this pull request with Python 2.7 but I had to make some changes that I have documented above. I will merge this PR as soon as the requested changes will be reviewed and included by @ezietsman |
Yes, I disabled fpectl completely. That module is not available in python 3 so I'll have to look at that in some more detail. The build worked in python 2.7 and 3.6, besides for that one test. I'll have a look and fix the issues. |
@ezietsman are you sure that fpectl isn't available in python 3? This documentation for python 3 states that it isn't built by default and discourages the use of it, as opposed to it not being available at all. https://docs.python.org/3/library/fpectl.html And anyway aren't we building the fpectl module ourselves anyway via fpectlmodule.cpp in the tests directory? |
I'll have a look at that source code and try to make it work. |
Ah, forgot about the Mac OSX issue with building fpectl. It may be as simple as adding some Mac OSX ifdef to call feraiseexcept instead feenableexcept etc. |
I've added the fpect module back in, it seems to compile now using clang on macos but only for python 2.7. The problem here is that the way modules are wrapped in python 3 has changed. So this part:
needs to change when it is compiled using python 3.0. The new way well work in 2.7 too. I'll investigate further. |
https://docs.python.org/3/howto/cporting.html I think explains it. I'll look at it later at home. |
@ezietsman thanks for your work, this is progressing very well. On my side I'm working on adding a small test to the Also for the record, our version of |
@ezietsman I saw that you modified the port number of the Telnet session from 1137 to 2222 in |
1137 worked and did not produce an Exception (which the test was looking for), so I changed it to one that raised an Exception. If that was wrong then the test is probably flawed. The test tested for an OSError exception. |
PR merged. Thank you very much @ezietsman. |
I cannot build the above code
I cannot build this part on python3.7 and ubuntu 18.04. cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ |
@kkz003 |
No description provided.