在GitLab-CI中测试wxPython应用程序的问题

问题描述 投票:-1回答:2

我尝试为wxPython工具设置gitlab ci,但出现很多错误。在这里,我尝试为具有简单单元测试的wxPython hello世界示例设置gitlab ci。

我的.gitlab-ci.yml看起来像这样:

# This file is a template, and might need editing before it works on your project.
# Official language image. Look for the different tagged releases at:
# https://hub.docker.com/r/library/python/tags/
image: python:3.7

# Change pip's cache directory to be inside the project directory since we can
# only cache local items.
variables:
  PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"

# Pip's cache doesn't store the python packages
# https://pip.pypa.io/en/stable/reference/pip_install/#caching
#
# If you want to also cache the installed packages, you have to install
# them in a virtualenv and cache it as well.
cache:
  paths:
    - .cache/pip
    - .venv/

before_script:
  - python -V  # Print out python version for debugging
  - python -m venv .venv
  - source .venv/bin/activate
  - pip install --upgrade pip
  - pip install -U -r requirements.txt
  - pip install -U -f https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-18.04 wxPython

stages:
  - test

unit_test:
  stage: test
  script:
    - python -m unittest discover tests
  tags:
    - Docker, Linux64

当我按下它时,出现以下错误:

...
26 $ python -V
27 Python 3.8.1
28 $ python -m venv .venv
29 $ source .venv/bin/activate
30 $ pip install --upgrade pip
31 Collecting pip
32   Downloading https://files.pythonhosted.org/packages/00/b6/9cfa56b4081ad13874b0c6f96af8ce16cfbc1cb06bedf8e9164ce5551ec1/pip-19.3.1-py2.py3-none-any.whl (1.4MB)
33 Installing collected packages: pip
34   Found existing installation: pip 19.2.3
35     Uninstalling pip-19.2.3:
36       Successfully uninstalled pip-19.2.3
37 Successfully installed pip-19.3.1
38 $ pip install -U -r requirements.txt
39 Collecting numpy==1.18.1
40   Downloading https://files.pythonhosted.org/packages/41/38/b278d96baebc6a4818cfd9c0fb6f0e62013d5b87374bcf0f14a0e9b83ed5/numpy-1.18.1-cp38-cp38-manylinux1_x86_64.whl (20.6MB)
41 Collecting Pillow==7.0.0
42   Downloading https://files.pythonhosted.org/packages/1a/6a/e944b190abffe5272a571084bc2fc59bb9051abea7f6720c36662d47c0e0/Pillow-7.0.0-cp38-cp38-manylinux1_x86_64.whl (2.1MB)
43 Collecting six==1.14.0
44   Downloading https://files.pythonhosted.org/packages/65/eb/1f97cb97bfc2390a276969c6fae16075da282f5058082d4cb10c6c5c1dba/six-1.14.0-py2.py3-none-any.whl
45 Installing collected packages: numpy, Pillow, six
46 Successfully installed Pillow-7.0.0 numpy-1.18.1 six-1.14.0
47 $ pip install -U -f https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-18.04 wxPython
48 Looking in links: https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-18.04
49 Collecting wxPython
50   Downloading https://files.pythonhosted.org/packages/b9/8b/31267dd6d026a082faed35ec8d97522c0236f2e083bf15aff64d982215e1/wxPython-4.0.7.post2.tar.gz (68.9MB)
51 Requirement already satisfied, skipping upgrade: pillow in ./.venv/lib/python3.8/site-packages (from wxPython) (7.0.0)
52 Requirement already satisfied, skipping upgrade: six in ./.venv/lib/python3.8/site-packages (from wxPython) (1.14.0)
53 Requirement already satisfied, skipping upgrade: numpy in ./.venv/lib/python3.8/site-packages (from wxPython) (1.18.1)
54 Installing collected packages: wxPython
55     Running setup.py install for wxPython: started
56     Running setup.py install for wxPython: finished with status 'error'
57     ERROR: Command errored out with exit status 1:
58      command: /builds/breitzke/wx_python_gitlab_ci/.venv/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-hchboga_/wxPython/setup.py'"'"'; __file__='"'"'/tmp/pip-install-hchboga_/wxPython/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-edvayp6d/install-record.txt --single-version-externally-managed --compile --install-headers /builds/breitzke/wx_python_gitlab_ci/.venv/include/site/python3.8/wxPython
59          cwd: /tmp/pip-install-hchboga_/wxPython/
60     Complete output (407 lines):
61     running install
62     running build
63     WARNING: Building this way assumes that all generated files have been
64     generated already.  If that is not the case then use build.py directly
65     to generate the source and perform the build stage.  You can use
66     --skip-build with the bdist_* or install commands to avoid this
67     message and the wxWidgets and Phoenix build steps in the future.
68     
69     "/builds/breitzke/wx_python_gitlab_ci/.venv/bin/python" -u build.py build
70     Will build using: "/builds/breitzke/wx_python_gitlab_ci/.venv/bin/python"
71     3.8.1 (default, Jan  3 2020, 22:44:00)
72     [GCC 8.3.0]
73     Python's architecture is 64bit
74     cfg.VERSION: 4.0.7.post2
75     
76     Running command: build
77     Running command: build_wx
78     wxWidgets build options: ['--wxpython', '--unicode', '--gtk3']
79     Configure options: ['--enable-unicode', '--with-gtk=3', '--enable-sound', '--enable-graphics_ctx', '--enable-display', '--enable-geometry', '--enable-debug_flag', '--enable-optimise', '--disable-debugreport', '--enable-uiactionsim', '--enable-autoidman', '--with-sdl']
80     /tmp/pip-install-hchboga_/wxPython/ext/wxWidgets/configure --enable-unicode --with-gtk=3 --enable-sound --enable-graphics_ctx --enable-display --enable-geometry --enable-debug_flag --enable-optimise --disable-debugreport --enable-uiactionsim --enable-autoidman --with-sdl
81     checking build system type... x86_64-pc-linux-gnu
82     checking host system type... x86_64-pc-linux-gnu
83     checking for --disable-gui... no
84     checking for --enable-monolithic... no
85     checking for --enable-plugins... no
86     checking for --without-subdirs... no
87     checking for --enable-official_build... no
88     checking for --disable-all-features... no
89     checking for --enable-universal... no
90     checking for --enable-nanox... no
91     checking for --enable-gpe... no
92     checking for toolkit... gtk
93     checking for --with-libpng... yes
94     checking for --with-libjpeg... yes
95     checking for --with-libtiff... yes
96     checking for --without-libjbig... no
97     checking for --without-liblzma... no
98     checking for --with-libxpm... yes
99     checking for --with-libiconv... yes
100     checking for --with-libmspack... no
101     checking for --without-gtkprint... no
102     checking for --with-gnomevfs... no
103     checking for --with-libnotify... yes
104     checking for --with-hildon... no
105     checking for --with-opengl... auto
106     checking for --with-dmalloc... no
107     checking for --with-sdl... yes
108     checking for --with-regex... yes
109     checking for --with-zlib... yes
110     checking for --with-expat... yes
111     checking for --with-macosx-sdk...
112     checking for --with-macosx-version-min...
113     checking for --enable-debug... default
114     checking for --disable-debug_flag... no
115     checking for --enable-debug_info... no
116     checking for --enable-debug_gdb... no
117     checking for --enable-debug_cntxt... no
118     checking for --enable-mem_tracing... no
119     checking for --disable-shared... no
120     checking for --enable-stl... no
121     checking for --enable-std_containers... no
122     checking for --enable-std_iostreams... yes
123     checking for --enable-std_string... yes
124     checking for --enable-std_string_conv_in_wxstring... no
125     checking for --disable-unicode... no
126     checking for --enable-mslu... no
127     checking for --enable-utf8... no
128     checking for --enable-utf8only... no
129     checking for --enable-extended_rtti... no
130     checking for --disable-optimise... no
131     checking for --enable-profile... no
132     checking for --enable-no_rtti... no
133     checking for --enable-no_exceptions... no
134     checking for --enable-permissive... no
135     checking for --enable-no_deps... no
136     checking for --disable-vararg_macros... no
137     checking for --enable-universal_binary... no
138     checking for --enable-macosx_arch... no
139     checking for --enable-compat26... no
140     checking for --disable-compat28... no
141     checking for --disable-rpath... no
142     checking for --enable-objc_uniquifying... no
143     checking for --disable-visibility... no
144     checking for --disable-tls... no
145     checking for --enable-intl... yes
146     checking for --enable-xlocale... yes
147     checking for --enable-config... yes
148     checking for --enable-protocols... yes
149     checking for --enable-ftp... yes
150     checking for --enable-http... yes
151     checking for --enable-fileproto... yes
152     checking for --enable-sockets... yes
153     checking for --enable-ipv6... no
154     checking for --enable-ole... yes
155     checking for --enable-dataobj... yes
156     checking for --enable-ipc... yes
157     checking for --enable-baseevtloop... yes
158     checking for --enable-epollloop... yes
159     checking for --enable-selectloop... yes
160     checking for --enable-any... yes
161     checking for --enable-apple_ieee... yes
162     checking for --enable-arcstream... yes
163     checking for --enable-base64... yes
164     checking for --enable-backtrace... yes
165     checking for --enable-catch_segvs... yes
166     checking for --enable-cmdline... yes
167     checking for --enable-datetime... yes
168     checking for --enable-debugreport... no
169     checking for --enable-dialupman... yes
170     checking for --enable-dynlib... yes
171     checking for --enable-dynamicloader... yes
172     checking for --enable-exceptions... yes
173     checking for --enable-ffile... yes
174     checking for --enable-file... yes
175     checking for --enable-filehistory... yes
176     checking for --enable-filesystem... yes
177     checking for --enable-fontenum... yes
178     checking for --enable-fontmap... yes
179     checking for --enable-fs_archive... yes
180     checking for --enable-fs_inet... yes
181     checking for --enable-fs_zip... yes
182     checking for --enable-fsvolume... yes
183     checking for --enable-fswatcher... yes
184     checking for --enable-geometry... yes
185     checking for --enable-log... yes
186     checking for --enable-longlong... yes
187     checking for --enable-mimetype... yes
188     checking for --enable-printfposparam... yes
189     checking for --enable-snglinst... yes
190     checking for --enable-sound... yes
191     checking for --enable-stdpaths... yes
192     checking for --enable-stopwatch... yes
193     checking for --enable-streams... yes
194     checking for --enable-sysoptions... yes
195     checking for --enable-tarstream... yes
196     checking for --enable-textbuf... yes
197     checking for --enable-textfile... yes
198     checking for --enable-timer... yes
199     checking for --enable-variant... yes
200     checking for --enable-zipstream... yes
201     checking for --enable-url... yes
202     checking for --enable-protocol... yes
203     checking for --enable-protocol_http... yes
204     checking for --enable-protocol_ftp... yes
205     checking for --enable-protocol_file... yes
206     checking for --enable-threads... yes
207     checking for --enable-iniconf... no
208     checking for --enable-regkey... yes
209     checking for --enable-docview... yes
210     checking for --enable-help... yes
211     checking for --enable-mshtmlhelp... yes
212     checking for --enable-html... yes
213     checking for --enable-htmlhelp... yes
214     checking for --enable-xrc... yes
215     checking for --enable-aui... yes
216     checking for --enable-propgrid... yes
217     checking for --enable-ribbon... yes
218     checking for --enable-stc... yes
219     checking for --enable-constraints... yes
220     checking for --enable-loggui... yes
221     checking for --enable-logwin... yes
222     checking for --enable-logdialog... yes
223     checking for --enable-mdi... yes
224     checking for --enable-mdidoc... yes
225     checking for --enable-mediactrl... auto
226     checking for --enable-gstreamer8... no
227     checking for --enable-richtext... yes
228     checking for --enable-postscript... yes
229     checking for --enable-printarch... yes
230     checking for --enable-svg... yes
231     checking for --enable-webkit... yes
232     checking for --enable-webview... yes
233     checking for --enable-graphics_ctx... yes
234     checking for --enable-clipboard... yes
235     checking for --enable-dnd... yes
236     checking for --disable-controls... no
237     checking for --enable-markup... yes
238     checking for --enable-accel... yes
239     checking for --enable-animatectrl... yes
240     checking for --enable-bannerwindow... yes
241     checking for --enable-artstd... yes
242     checking for --enable-arttango... auto
243     checking for --enable-bmpbutton... yes
244     checking for --enable-bmpcombobox... yes
245     checking for --enable-button... yes
246     checking for --enable-calendar... yes
247     checking for --enable-caret... yes
248     checking for --enable-checkbox... yes
249     checking for --enable-checklst... yes
250     checking for --enable-choice... yes
251     checking for --enable-choicebook... yes
252     checking for --enable-collpane... yes
253     checking for --enable-colourpicker... yes
254     checking for --enable-combobox... yes
255     checking for --enable-comboctrl... yes
256     checking for --enable-commandlinkbutton... yes
257     checking for --enable-dataviewctrl... yes
258     checking for --enable-datepick... yes
259     checking for --enable-detect_sm... yes
260     checking for --enable-dirpicker... yes
261     checking for --enable-display... yes
262     checking for --enable-editablebox... yes
263     checking for --enable-filectrl... yes
264     checking for --enable-filepicker... yes
265     checking for --enable-fontpicker... yes
266     checking for --enable-gauge... yes
267     checking for --enable-grid... yes
268     checking for --enable-headerctrl... yes
269     checking for --enable-hyperlink... yes
270     checking for --enable-imaglist... yes
271     checking for --enable-infobar... yes
272     checking for --enable-listbook... yes
273     checking for --enable-listbox... yes
274     checking for --enable-listctrl... yes
275     checking for --enable-notebook... yes
276     checking for --enable-notifmsg... yes
277     checking for --enable-odcombobox... yes
278     checking for --enable-popupwin... yes
279     checking for --enable-prefseditor... yes
280     checking for --enable-radiobox... yes
281     checking for --enable-radiobtn... yes
282     checking for --enable-richmsgdlg... yes
283     checking for --enable-richtooltip... yes
284     checking for --enable-rearrangectrl... yes
285     checking for --enable-sash... yes
286     checking for --enable-scrollbar... yes
287     checking for --enable-searchctrl... yes
288     checking for --enable-slider... yes
289     checking for --enable-spinbtn... yes
290     checking for --enable-spinctrl... yes
291     checking for --enable-splitter... yes
292     checking for --enable-statbmp... yes
293     checking for --enable-statbox... yes
294     checking for --enable-statline... yes
295     checking for --enable-stattext... yes
296     checking for --enable-statusbar... yes
297     checking for --enable-taskbaricon... yes
298     checking for --enable-tbarnative... yes
299     checking for --enable-textctrl... yes
300     checking for --enable-timepick... yes
301     checking for --enable-tipwindow... yes
302     checking for --enable-togglebtn... yes
303     checking for --enable-toolbar... yes
304     checking for --enable-toolbook... yes
305     checking for --enable-treebook... yes
306     checking for --enable-treectrl... yes
307     checking for --enable-treelist... yes
308     checking for --enable-commondlg... yes
309     checking for --enable-aboutdlg... yes
310     checking for --enable-choicedlg... yes
311     checking for --enable-coldlg... yes
312     checking for --enable-filedlg... yes
313     checking for --enable-finddlg... yes
314     checking for --enable-fontdlg... yes
315     checking for --enable-dirdlg... yes
316     checking for --enable-msgdlg... yes
317     checking for --enable-numberdlg... yes
318     checking for --enable-splash... yes
319     checking for --enable-textdlg... yes
320     checking for --enable-tipdlg... yes
321     checking for --enable-progressdlg... yes
322     checking for --enable-wizarddlg... yes
323     checking for --enable-menus... yes
324     checking for --enable-miniframe... yes
325     checking for --enable-tooltips... yes
326     checking for --enable-splines... yes
327     checking for --enable-mousewheel... yes
328     checking for --enable-validators... yes
329     checking for --enable-busyinfo... yes
330     checking for --enable-hotkey... auto
331     checking for --enable-joystick... yes
332     checking for --enable-metafile... auto
333     checking for --enable-dragimage... yes
334     checking for --enable-accessibility... no
335     checking for --enable-uiactionsim... yes
336     checking for --enable-dctransform... yes
337     checking for --enable-webviewwebkit... yes
338     checking for --enable-palette... yes
339     checking for --enable-image... yes
340     checking for --enable-gif... yes
341     checking for --enable-pcx... yes
342     checking for --enable-tga... yes
343     checking for --enable-iff... yes
344     checking for --enable-pnm... yes
345     checking for --enable-xpm... yes
346     checking for --enable-ico_cur... yes
347     checking for --enable-dccache... yes
348     checking for --enable-ps-in-msw... yes
349     checking for --enable-ownerdrawn... yes
350     checking for --enable-uxtheme... yes
351     checking for --enable-wxdib... yes
352     checking for --enable-webviewie... yes
353     checking for --enable-autoidman... yes
354     checking for gcc... gcc
355     checking whether the C compiler works... yes
356     checking for C compiler default output file name... a.out
357     checking for suffix of executables...
358     checking whether we are cross compiling... no
359     checking for suffix of object files... o
360     checking whether we are using the GNU C compiler... yes
361     checking whether gcc accepts -g... yes
362     checking for gcc option to accept ISO C89... none needed
363     checking whether we are using the Intel C compiler... no
364     checking how to run the C preprocessor... gcc -E
365     checking for grep that handles long lines and -e... /bin/grep
366     checking for egrep... /bin/grep -E
367     checking whether gcc needs -traditional... no
368     checking for g++... g++
369     checking whether we are using the GNU C++ compiler... yes
370     checking whether g++ accepts -g... yes
371     checking whether we are using the Intel C++ compiler... no
372     checking whether we are using the Sun C++ compiler... no
373     checking for ar... ar
374     checking for ANSI C header files... yes
375     checking for sys/types.h... yes
376     checking for sys/stat.h... yes
377     checking for stdlib.h... yes
378     checking for string.h... yes
379     checking for memory.h... yes
380     checking for strings.h... yes
381     checking for inttypes.h... yes
382     checking for stdint.h... yes
383     checking for unistd.h... yes
384     checking for langinfo.h... yes
385     checking for wchar.h... yes
386     checking for sys/select.h... yes
387     checking for cxxabi.h... yes
388     checking for an ANSI C-conforming const... yes
389     checking for inline... inline
390     checking size of short... 2
391     checking size of void *... 8
392     checking size of int... 4
393     checking size of long... 8
394     checking size of size_t... 8
395     checking size of long long... 8
396     checking size of wchar_t... 4
397     checking for va_copy... yes
398     checking whether the compiler supports variadic macros... yes
399     checking for _FILE_OFFSET_BITS value needed for large files... 64
400     checking if large file support is available... yes
401     checking for _LARGEFILE_SOURCE value needed for large files... no
402     checking whether byte ordering is bigendian... no
403     checking for iostream... yes
404     checking if C++ compiler supports the explicit keyword... yes
405     checking for std::wstring in <string>... yes
406     checking for std::istream... yes
407     checking for std::ostream... yes
408     checking how to run the C++ preprocessor... g++ -E
409     checking type_traits usability... yes
410     checking type_traits presence... yes
411     checking for type_traits... yes
412     checking for __sync_fetch_and_add and __sync_sub_and_fetch builtins... yes
413     checking for libraries directories... /usr/lib/x86_64-linux-gnu /usr/lib
414     checking for cos... no
415     checking for floor... no
416     checking if floating point functions link without -lm... no
417     checking for sin... yes
418     checking for ceil... yes
419     checking if floating point functions link with -lm... yes
420     checking for strtoull... yes
421     checking for pkg-config... /usr/bin/pkg-config
422     checking pkg-config is at least version 0.9.0... yes
423     configure: WARNING: Defaulting to the builtin regex library for Unicode build.
424     checking for zlib.h >= 1.1.4... yes
425     checking for zlib.h... (cached) yes
426     checking for deflate in -lz... yes
427     checking for png.h > 0.90... yes
428     checking for png.h... (cached) yes
429     checking for png_sig_cmp in -lpng... yes
430     checking for jpeglib.h... yes
431     checking for jpeg_read_header in -ljpeg... yes
432     checking for tiffio.h... yes
433     checking for TIFFError in -ltiff... yes
434     checking for expat.h... yes
435     checking if expat.h is valid C++ header... yes
436     checking for XML_ParserCreate in -lexpat... yes
437     checking for GTK+ version...
438     checking for pkg-config... /usr/bin/pkg-config
439     checking for GTK+ - version >= 3.0.0... Package gtk+-3.0 was not found in the pkg-config search path.
440     Perhaps you should add the directory containing `gtk+-3.0.pc'
441     to the PKG_CONFIG_PATH environment variable
442     No package 'gtk+-3.0' found
443     no
444     *** Could not run GTK+ test program, checking why...
445     *** The test program failed to compile or link. See the file config.log for the
446     *** exact error that occured. This usually means GTK+ is incorrectly installed.
447     configure: error:
448     The development files for GTK+ were not found. For GTK+ 2, please
449     ensure that pkg-config is in the path and that gtk+-2.0.pc is
450     installed. For GTK+ 1.2 please check that gtk-config is in the path,
451     and that the version is 1.2.3 or above. Also check that the
452     libraries returned by 'pkg-config gtk+-2.0 --libs' or 'gtk-config
453     --libs' are in the LD_LIBRARY_PATH or equivalent.
454     
455     Error running configure
456     ERROR: failed building wxWidgets
457     Traceback (most recent call last):
458       File "build.py", line 1468, in cmd_build_wx
459         wxbuild.main(wxDir(), build_options)
460       File "/tmp/pip-install-hchboga_/wxPython/buildtools/build_wxwidgets.py", line 371, in main
461         exitIfError(wxBuilder.configure(dir=wxRootDir, options=configure_opts),
462       File "/tmp/pip-install-hchboga_/wxPython/buildtools/build_wxwidgets.py", line 85, in exitIfError
463         raise builder.BuildError(msg)
464     buildtools.builder.BuildError: Error running configure
465     Finished command: build_wx (0m13.119s)
466     Finished command: build (0m13.119s)
467     Command '"/builds/breitzke/wx_python_gitlab_ci/.venv/bin/python" -u build.py build' failed with exit code 1.
468     ----------------------------------------
469 ERROR: Command errored out with exit status 1: /builds/breitzke/wx_python_gitlab_ci/.venv/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-hchboga_/wxPython/setup.py'"'"'; __file__='"'"'/tmp/pip-install-hchboga_/wxPython/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-edvayp6d/install-record.txt --single-version-externally-managed --compile --install-headers /builds/breitzke/wx_python_gitlab_ci/.venv/include/site/python3.8/wxPython Check the logs for full command output.
473 ERROR: Job failed: exit code 1

编辑:

由于@jonrsharpe的评论,我将.gitlab-ci.yml更改为:

image: python:3.7

variables:
  PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"

cache:
  paths:
    - .cache/pip
    - .venv/

before_script:
  - apt-get update -qq
  - apt-get install -qq -y libgtk-3-dev 
  - python -V
  - python -m venv .venv
  - source .venv/bin/activate
  - pip install --upgrade pip
  - pip install -U -r requirements.txt
  - wget "https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-18.04/wxPython-4.0.7.post2-cp37-cp37m-linux_x86_64.whl"
  - pip install wxPython-4.0.7.post2-cp37-cp37m-linux_x86_64.whl

stages:
  - test

unit_test:
  stage: test
  script:
    - python -m unittest discover hello_world
  tags:
    - Docker, Linux64

但是现在我得到了另一个错误:

...
3065 Successfully installed wxPython-4.0.7.post2
3066 $ python -m unittest discover hello_world
3067 E
3068 ======================================================================
3069 ERROR: test_hello_world (unittest.loader._FailedTest)
3070 ----------------------------------------------------------------------
3071 ImportError: Failed to import test module: test_hello_world
3072 Traceback (most recent call last):
3073   File "/usr/local/lib/python3.7/unittest/loader.py", line 436, in _find_test_path
3074     module = self._get_module_from_name(name)
3075   File "/usr/local/lib/python3.7/unittest/loader.py", line 377, in _get_module_from_name
3076     __import__(name)
3077   File "/builds/breitzke/wx_python_gitlab_ci/hello_world/test_hello_world.py", line 7, in <module>
3078     import wx
3079   File "/builds/breitzke/wx_python_gitlab_ci/.venv/lib/python3.7/site-packages/wx/__init__.py", line 17, in <module>
3080     from wx.core import *
3081   File "/builds/breitzke/wx_python_gitlab_ci/.venv/lib/python3.7/site-packages/wx/core.py", line 12, in <module>
3082     from ._core import *
3083 ImportError: libjpeg.so.8: cannot open shared object file: No such file or directory
3084 ----------------------------------------------------------------------
3085 Ran 1 test in 0.001s
3086 FAILED (errors=1)
3087 ERROR: Job failed: exit code 1

你知道我现在做错了什么吗?

谢谢你!

python gitlab wxpython gitlab-ci
2个回答
0
投票

使用与wxPython不同的docker映像,我将其启动并运行。我的新.gitlab-ci.yml

image: wxpython4/build:ubuntu-18.04

variables:
  PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"

cache:
  paths:
    - .cache/pip
    - .venv/

before_script:
  - python3.7 -m venv .venv
  - source .venv/bin/activate
  - pip install --upgrade pip
  - pip install -r requirements_server.txt
  - pip install -U -f https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-18.04 wxPython

stages:
  - test

unit_test:
  stage: test
  script:
    - python -m unittest discover hello_world
  tags:
    - Docker, Linux64

0
投票

我不确定依靠wxpython4/build:ubuntu-18.04 docker镜像是否明智。我将其制成供自己使用,并且会可能对其进行更新,但是我不能保证会一直这样做。

您收到的libjpeg.so.8错误表明未安装相应的系统库。实际上,您可能会丢失许多系统库软件包,但可以使用其他apt-get命令安装它们。

您可以在以下位置看到我的docker容器中安装的deb软件包:https://github.com/wxWidgets/Phoenix/blob/master/docker/build/ubuntu-18.04/Dockerfile#L30。这些大多是-dev软件包,但是对于运行测试,您可能只需要相应的非dev软件包,这将节省一些时间和空间。

© www.soinside.com 2019 - 2024. All rights reserved.