[python-ldap] [PATCH] Tests: Don't overwrite the server attribute of parent class

Michael Ströder michael at stroeder.com
Thu Nov 16 11:02:18 EST 2017


Miro Hrončok wrote:
> We'd find out that the code in
> Tests/t_ldapobject.py::Test01_SimpleLDAPObject overwrites the server
> attribute of parent class by calling SlapdTestCase.setUpClass()
> directly. This might in some cases be problematic, as described in [0],
> a fix is to use super().
> [0] https://github.com/pyldap/pyldap/pull/122

Reading [0] it's my impression that you're relying on a false
assumption: Let me state very clear that each instance of SlapdTestCase
or a derived class is supposed to be used one-shot only and start its
isolated slapd process and tear it down later. All current tests are and
all future tests will be written based on this assumption.

Nevertheless I agree that the class method should not change the class.

> Attaching a patch for python-ldap. Source: [1]
> [1] https://github.com/pyldap/pyldap/pull/122#issuecomment-327441677

I wonder why you only tweaked t_ldapobject.py because the very same call
to SlapdTestCase.setUpClass() is also in t_cext.py.

Ciao, Michael.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3829 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://mail.python.org/pipermail/python-ldap/attachments/20171116/85a34805/attachment.bin>

More information about the python-ldap mailing list