OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

How does one test a Kivy App on GitHub actions MacOS Runner?

  • Thread starter Thread starter user25728972
  • Start date Start date
U

user25728972

Guest
I am trying to use GitHub actions to test my Kivy application on various operating systems. I am having trouble however running the app on MacOS operating systems and keep getting this error:

Code:
INFO     kivy:__init__.py:67 Window: Provider: sdl2
CRITICAL kivy:__init__.py:99 Window: Unable to find any valuable Window provider. Please enable debug logging (e.g. add -d if running from the command line, or change the log level in the config) and re-run your app to identify potential causes
sdl2 - RuntimeError: b'Failed creating OpenGL pixel format'
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/kivy/core/__init__.py", line 71, in core_select_lib
    cls = cls()
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/kivy/core/window/window_sdl2.py", line 165, in __init__
    super(WindowSDL, self).__init__()
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/kivy/core/window/__init__.py", line 1129, in __init__
    self.create_window()
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/kivy/core/window/window_sdl2.py", line 316, in create_window
    self.system_size = self._win.setup_window(
  File "kivy/core/window/_window_sdl2.pyx", line 243, in kivy.core.window._window_sdl2._WindowSDL2Storage.setup_window
  File "kivy/core/window/_window_sdl2.pyx", line 76, in kivy.core.window._window_sdl2._WindowSDL2Storage.die

I am able to get it working on windows and linux runners. Does GitHub's MacOS runner not support OpenGL or is there a way to resolve this?

My test application is:

Code:
from kivy.uix.label import Label
from kivy.app import App


class SimpleApp(App):
    def __init__(self, **kwargs):
        super(SimpleApp, self).__init__(**kwargs)
        self.text = "Hello World"

    def build(self):
        return Label(text=self.text)


if __name__ == '__main__':
    SimpleApp().run()

My testing code is:

Code:
import unittest
import time
from functools import partial
from kivy.clock import Clock

from simpleapp import SimpleApp


class Test(unittest.TestCase):

    def pause(*args):
        time.sleep(0.000001)

    def run_test(self, app, *args):
        self.assertEqual(app.text, "Hello World")
        app.stop()

    def test_example(self):
        app = SimpleApp()
        p = partial(self.run_test, app)
        Clock.schedule_once(p, 0.000001)
        app.run()


if __name__ == '__main__':
    unittest.main()

And my workflow file is:

Code:
name: Python application

on:
  push:
    branches: [ "master" ]
  pull_request:
    branches: [ "master" ]
  workflow_dispatch:

permissions:
  contents: read

jobs:
  mac_test:

    runs-on: macos-latest

    steps:
      - uses: actions/checkout@v4
      - name: Set up Python 3.10
        uses: actions/setup-python@v4
        with:
          python-version: "3.10"
      - name: Install dependencies
        run: |
          python -m pip install --upgrade pip
          python -m pip install kivy pytest
      - name: Test App
        run: |
          python -m pytest
<p>I am trying to use GitHub actions to test my Kivy application on various operating systems. I am having trouble however running the app on MacOS operating systems and keep getting this error:</p>
<pre><code>INFO kivy:__init__.py:67 Window: Provider: sdl2
CRITICAL kivy:__init__.py:99 Window: Unable to find any valuable Window provider. Please enable debug logging (e.g. add -d if running from the command line, or change the log level in the config) and re-run your app to identify potential causes
sdl2 - RuntimeError: b'Failed creating OpenGL pixel format'
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/kivy/core/__init__.py", line 71, in core_select_lib
cls = cls()
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/kivy/core/window/window_sdl2.py", line 165, in __init__
super(WindowSDL, self).__init__()
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/kivy/core/window/__init__.py", line 1129, in __init__
self.create_window()
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/kivy/core/window/window_sdl2.py", line 316, in create_window
self.system_size = self._win.setup_window(
File "kivy/core/window/_window_sdl2.pyx", line 243, in kivy.core.window._window_sdl2._WindowSDL2Storage.setup_window
File "kivy/core/window/_window_sdl2.pyx", line 76, in kivy.core.window._window_sdl2._WindowSDL2Storage.die
</code></pre>
<p>I am able to get it working on windows and linux runners. Does GitHub's MacOS runner not support OpenGL or is there a way to resolve this?</p>
<p>My test application is:</p>
<pre><code>from kivy.uix.label import Label
from kivy.app import App


class SimpleApp(App):
def __init__(self, **kwargs):
super(SimpleApp, self).__init__(**kwargs)
self.text = "Hello World"

def build(self):
return Label(text=self.text)


if __name__ == '__main__':
SimpleApp().run()
</code></pre>
<p>My testing code is:</p>
<pre><code>import unittest
import time
from functools import partial
from kivy.clock import Clock

from simpleapp import SimpleApp


class Test(unittest.TestCase):

def pause(*args):
time.sleep(0.000001)

def run_test(self, app, *args):
self.assertEqual(app.text, "Hello World")
app.stop()

def test_example(self):
app = SimpleApp()
p = partial(self.run_test, app)
Clock.schedule_once(p, 0.000001)
app.run()


if __name__ == '__main__':
unittest.main()
</code></pre>
<p>And my workflow file is:</p>
<pre><code>name: Python application

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
workflow_dispatch:

permissions:
contents: read

jobs:
mac_test:

runs-on: macos-latest

steps:
- uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install kivy pytest
- name: Test App
run: |
python -m pytest
</code></pre>
 

Latest posts

Top