找不到ALSA -GITHUB操作单元测试,正确设置Env/Envvars
我的.github/Workflows文件夹中有以下YAML。
name: Run Python Tests
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["2.7", "3.6", "3.7", "3.8", "3.9"]
steps:
- uses: actions/checkout@v3
- name: Install Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Run tests with unittest
run: python -m unittest test.py
当我制作PR时,它会运行测试...但是它们在Github中失败,而不是在我的本地机器上。
错误如下:
0s
Run python -m unittest test.py
ALSA lib confmisc.c:767:(parse_card) cannot find card '0'
ALSA lib conf.c:4732:(_snd_config_evaluate) function snd_func_card_driver returned error: No such file or directory
ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings
ALSA lib conf.c:4732:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
ALSA lib confmisc.c:1246:(snd_func_refer) error evaluating name
ALSA lib conf.c:4732:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5220:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2642:(snd_pcm_open_noupdate) Unknown PCM default
ALSA lib confmisc.c:767:(parse_card) cannot find card '0'
ALSA lib conf.c:4732:(_snd_config_evaluate) function snd_func_card_driver returned error: No such file or directory
ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings
ALSA lib conf.c:4732:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
ALSA lib confmisc.c:1246:(snd_func_refer) error evaluating name
ALSA lib conf.c:4732:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5220:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2642:(snd_pcm_open_noupdate) Unknown PCM default
Traceback (most recent call last):
File "/opt/hostedtoolcache/Python/3.8.12/x64/lib/python3.8/runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/opt/hostedtoolcache/Python/3.8.12/x64/lib/python3.8/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/opt/hostedtoolcache/Python/3.8.12/x64/lib/python3.8/unittest/__main__.py", line 18, in <module>
main(module=None)
File "/opt/hostedtoolcache/Python/3.8.12/x64/lib/python3.8/unittest/main.py", line 100, in __init__
self.parseArgs(argv)
File "/opt/hostedtoolcache/Python/3.8.12/x64/lib/python3.8/unittest/main.py", line 147, in parseArgs
self.createTests()
File "/opt/hostedtoolcache/Python/3.8.12/x64/lib/python3.8/unittest/main.py", line 158, in createTests
self.test = self.testLoader.loadTestsFromNames(self.testNames,
File "/opt/hostedtoolcache/Python/3.8.12/x64/lib/python3.8/unittest/loader.py", line 220, in loadTestsFromNames
suites = [self.loadTestsFromName(name, module) for name in names]
File "/opt/hostedtoolcache/Python/3.8.12/x64/lib/python3.8/unittest/loader.py", line 220, in <listcomp>
suites = [self.loadTestsFromName(name, module) for name in names]
File "/opt/hostedtoolcache/Python/3.8.12/x64/lib/python3.8/unittest/loader.py", line 154, in loadTestsFromName
module = __import__(module_name)
File "/home/runner/work/2dshooter/2dshooter/test.py", line 5, in <module>
from test_func import *
File "/home/runner/work/2dshooter/2dshooter/test/test_func.py", line 2, in <module>
from func import *
File "/home/runner/work/2dshooter/2dshooter/func.py", line 6, in <module>
from values import *
File "/home/runner/work/2dshooter/2dshooter/values.py", line 10, in <module>
pygame.mixer.init()
pygame.error: ALSA: Couldn't open audio device: No such file or directory
pygame 2.1.2 (SDL 2.0.16, Python 3.8.12)
Hello from the pygame community. https://www.pygame.org/contribute.html
VALUE INIT
Error: Process completed with exit code 1.
阅读 - 罪魁祸首似乎是当我们
runs-on: ubuntu-latest
不包括音频驱动程序时实际上并不存在的音频驱动程序吗?
我已经尝试将以下内容添加到也不起作用的YAML文件(直接在运行的下方)中
env:
SDL_AUDIODRIVER: 'ALSA'
- 并产生相同的错误。
那么,如何在Github中获取容器以具有正确的音频驱动程序?
I have the following yaml in my .github/workflows folder.
name: Run Python Tests
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["2.7", "3.6", "3.7", "3.8", "3.9"]
steps:
- uses: actions/checkout@v3
- name: Install Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Run tests with unittest
run: python -m unittest test.py
when I make a PR, it runs the tests... however they fail in github and not on my local machine.
the error is as follows:
0s
Run python -m unittest test.py
ALSA lib confmisc.c:767:(parse_card) cannot find card '0'
ALSA lib conf.c:4732:(_snd_config_evaluate) function snd_func_card_driver returned error: No such file or directory
ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings
ALSA lib conf.c:4732:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
ALSA lib confmisc.c:1246:(snd_func_refer) error evaluating name
ALSA lib conf.c:4732:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5220:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2642:(snd_pcm_open_noupdate) Unknown PCM default
ALSA lib confmisc.c:767:(parse_card) cannot find card '0'
ALSA lib conf.c:4732:(_snd_config_evaluate) function snd_func_card_driver returned error: No such file or directory
ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings
ALSA lib conf.c:4732:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
ALSA lib confmisc.c:1246:(snd_func_refer) error evaluating name
ALSA lib conf.c:4732:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5220:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2642:(snd_pcm_open_noupdate) Unknown PCM default
Traceback (most recent call last):
File "/opt/hostedtoolcache/Python/3.8.12/x64/lib/python3.8/runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/opt/hostedtoolcache/Python/3.8.12/x64/lib/python3.8/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/opt/hostedtoolcache/Python/3.8.12/x64/lib/python3.8/unittest/__main__.py", line 18, in <module>
main(module=None)
File "/opt/hostedtoolcache/Python/3.8.12/x64/lib/python3.8/unittest/main.py", line 100, in __init__
self.parseArgs(argv)
File "/opt/hostedtoolcache/Python/3.8.12/x64/lib/python3.8/unittest/main.py", line 147, in parseArgs
self.createTests()
File "/opt/hostedtoolcache/Python/3.8.12/x64/lib/python3.8/unittest/main.py", line 158, in createTests
self.test = self.testLoader.loadTestsFromNames(self.testNames,
File "/opt/hostedtoolcache/Python/3.8.12/x64/lib/python3.8/unittest/loader.py", line 220, in loadTestsFromNames
suites = [self.loadTestsFromName(name, module) for name in names]
File "/opt/hostedtoolcache/Python/3.8.12/x64/lib/python3.8/unittest/loader.py", line 220, in <listcomp>
suites = [self.loadTestsFromName(name, module) for name in names]
File "/opt/hostedtoolcache/Python/3.8.12/x64/lib/python3.8/unittest/loader.py", line 154, in loadTestsFromName
module = __import__(module_name)
File "/home/runner/work/2dshooter/2dshooter/test.py", line 5, in <module>
from test_func import *
File "/home/runner/work/2dshooter/2dshooter/test/test_func.py", line 2, in <module>
from func import *
File "/home/runner/work/2dshooter/2dshooter/func.py", line 6, in <module>
from values import *
File "/home/runner/work/2dshooter/2dshooter/values.py", line 10, in <module>
pygame.mixer.init()
pygame.error: ALSA: Couldn't open audio device: No such file or directory
pygame 2.1.2 (SDL 2.0.16, Python 3.8.12)
Hello from the pygame community. https://www.pygame.org/contribute.html
VALUE INIT
Error: Process completed with exit code 1.
reading through that - it looks like the culprit is the audio driver not actually existing when we
runs-on: ubuntu-latest
does not include the audio driver?
I have tried adding the following to the yaml file (directly below that runs-on)
env:
SDL_AUDIODRIVER: 'ALSA'
that also did not work - and produces the same error.
so how Do I get the container in GitHub to have the correct audio driver?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
github操作计算机没有任何扬声器来输出音频,也没有输出视频的显示。这是一个无头系统。
解决方案是设置
请参见 https://github.com/github.com/pygame/pygame/pygame/pygame/2985 < /a>
A github actions computer doesn't have any speakers to output audio to, and no display to output video to. It's an headless system.
The solution is to set
See https://github.com/pygame/pygame/issues/2985