I added some drive-by comments, not a full review.
Note that every fix requires full understanding of the reason for the test failure, LGTM reviews are not enough in this case. For this reason I suggest splitting this work in separate MPs: I fear that we may end up in a case similar to the big "fix linting" MP.
I'd start by fixing the need to run the unit tests as root. The issue happens even when no test is run, and this case is reproducible in this way:
$ cd charms/focal/autopkgtest-web/webcontrol
$ python3 -m unittest -k I-do-not-exist
[errors]
I think one sensible way to fix this is replacing:
I added some drive-by comments, not a full review.
Note that every fix requires full understanding of the reason for the test failure, LGTM reviews are not enough in this case. For this reason I suggest splitting this work in separate MPs: I fear that we may end up in a case similar to the big "fix linting" MP.
I'd start by fixing the need to run the unit tests as root. The issue happens even when no test is run, and this case is reproducible in this way:
$ cd charms/ focal/autopkgte st-web/ webcontrol
$ python3 -m unittest -k I-do-not-exist
[errors]
I think one sensible way to fix this is replacing:
PATH = os.path. join(os. path.sep, "run", "autopkgtest_ webcontrol" )
with:
PATH = os.path. join(os. path.sep, os.getenv( "XDG_RUNTIME_ DIR", "/run"), "autopkgtest_ webcontrol" )
See [1] if you are not familiar with XDG_* variables.
[1] https:/ /specifications .freedesktop. org/basedir- spec/basedir- spec-latest. html