<not true> At first, tests do not need global variables, there could be instance variables (self.cert and self.newcert) </not true> (read comments)
test_0006_service_show uses global cert and then the cert is used in iteration, what means that cert variable is updated several times without any guarantee which value is the last.
certs_encoded = (base64.b64encode(cert) for cert in res['usercertificate'])
See example bellow:
In : cert = 1
In : def f():
...: global cert
...: l = [cert for cert in range(4)]
...: print cert
In : f()
In : cert
Now it accidentally works, but any change to test may cause "nice to debug" issues.
This blocks enabling of pylint check global-variable-not-assigned
Please note that pytest creates new instance of class for each testcase, so self.something will not work
Metadata Update from @mbasti:
- Issue assigned to mbasti
- Issue set to the milestone: FreeIPA 4.4.2
to comment on this ticket.