kivy-ios/tests/test_python3/main.py
Richard Larkin 64bd692632
Flake8 CI fixes (#451)
* Pep8 fixes

* tox Pep8 compliance

* Excluded external tools folder from flake 8 tests

* Added Flake 8 exclusions

* Pep8 fixes

* Pep8 fixes

* Corrected type

* Pep8 fixes

* Pep 8 compliance

* Pep8 fixes

* Pep8  fixes

* Pep8 fixes

* Pep8 fixes

* Pep 8 fixes

* Pep 8 fixes

* Pep8 fixes

* Pep8 fixes

* Pep8 fixes

* Pep8

* Pep8

* Pep 8

* Pep 8

* Pep8 fixes

* Pep8

* Pep8

* Pep8

* Pep8 fixes

* Pep8 fixes

* Pep8 fixes

* Pep8 fixes

* Pep8 fixes

* Revert chagnes

* Revert changes to kivy/__init.py

* Revert changes

* REvert changes

* Revert changes

* Revert changes to toolchain

* Add files exclusions to tox.ini

* Added exclusions for alias recipes

* Remove dead code

* Added py extension to recipes

* Removed recipe build skip

* Improves recipe matching

Previous expression was matching all the following three lines of a `git diff --name-only` output.
```
recipes/hostlibffi/__init__.py
recipes/hostpython.py
recipes/hostpython2/__init__.py
```
This was resulting to a bug when later splitting with `recipe = file_path.split('/')[1]` the `recipes/hostpython.py` string would return including the `\n` new line char, see:
 ```
>>> 'recipes/hostpython.py\n'.split('/')[1]
'hostpython.py\n'
>>> 'recipes/hostlibffi/__init__.py\n'.split('/')[1]
'hostlibffi'
>>> 
```

Co-authored-by: Andre Miras <AndreMiras@users.noreply.github.com>
2020-04-25 18:28:16 +02:00

56 lines
990 B
Python

print("Python 3 running!")
import sys
print(f"sys.path: {sys.path}")
import traceback
modules_to_tests = [
"math", "_sre", "array",
"binascii", "multiprocessing",
"subprocess"
]
for name in modules_to_tests:
print(f"- import {name}: ", end="")
try:
__import__(name)
print("OK")
except ImportError:
print("FAIL")
traceback.print_exc()
# test pyobjus
print("- import pyobjus start")
import pyobjus # noqa: F401
print("- import done")
from pyobjus import autoclass
NSNotificationCenter = autoclass("NSNotificationCenter")
# test ios
import ios # noqa: F401
from kivy.app import App
from kivy.lang import Builder
class TestApp(App):
def build(self):
return Builder.load_string("""
RelativeLayout:
GridLayout:
cols: 2
Button:
text: "Hello Python 3!"
font_size: dp(48)
TextInput:
font_size: dp(24)
Widget
Widget
""")
TestApp().run()