KeyError: 'VIKTOR_ADDONS_URL' when testing GEFFile


I wrote some unit tests in order to test some functions in my script. In these functions, data from a .GEF-file is parsed to a GEFFile object. When I run the tests locally they all pass, but when running them on Github in our CI pipeline I get the following error:

Traceback (most recent call last):
    parsed_gef = geffile.parse(
  File "viktor/geo.pyx", line 883, in viktor.geo.GEFFile.parse
  File "viktor/core.pyx", line 1477, in viktor.core._post_on_addon_endpoint
  File "/opt/hostedtoolcache/Python/3.10.9/x64/lib/python3.10/", line 680, in __getitem__
    raise KeyError(key) from None

We’re not sure why this error is raised/how it can be fixed.

Hi Martijn,

GEFs are parsed using an external VIKTOR service. These calls need to be mocked when using them in unittests. See this page in the documentation for more information: Development tools & tips - Writing automated tests | VIKTOR Documentation.