[PATCH] Python3 compatible tests and credentials module
Petr Viktorin
pviktori at redhat.com
Fri Nov 25 16:20:13 UTC 2016
On 11/25/2016 03:40 AM, Andrew Bartlett wrote:
> On Thu, 2016-11-24 at 14:59 +0100, Lumir Balhar wrote:
>> Hello.
>>
>> Because I have no response for two weeks on GitHub [0], I decided to
>> send my patches here. Which way is preferred, please?
>>
>> The first part of this PR contains changes necessary to run tests
>> with
>> Python 3. These changes should not have any impact on functionality
>> with
>> Python 2.
>> The second part ports the samba.credentials module to be Python 3
>> compatible, and also ports the credentials tests. The files
>> py3compat.h
>> and compat.py will help us with porting and to make the future code
>> more
>> readable. The py3compat.h file is the same as proposed by Petr
>> Viktorin
>> and discussed in this thread:
>> https://lists.samba.org/archive/samba-technical/2016-July/114998.html
>>
>> I am submitting the two parts as one PR because, without at least
>> one
>> module prepared for Python 3, it is impossible to try running tests
>> with
>> Python 3.
>>
>> [0] https://github.com/samba-team/samba/pull/68
>
> Thanks for the patch. The main thing I don't like is the if PY3 stuff,
> and the .args usage. I would rather we ported param and glue to
> python3 at the same time, they shouldn't be too hard.
The problem the PY3 guards are solving is that the main test module,
samba.tests, depends on most of Samba (dcerpc, param, ndr), and the main
samba module depends on param and _ldb
If porting needs to come with tests, either we need to port most of
Samba in one patchset, or the circular dependency needs to be cut somewhere.
I think the `if PY3` guards are the best solution here, but if you
disagree, sending a bigger patchset is of course possible.
As for param specifically, Python3 file objects are not directly backed
by FILE*, so the dump() methods in param are one of the tougher nuts to
crack during the porting. I think param would benefit from a separate
review, after preparations to run tests on py3 are done.
--
Petr Viktorin
More information about the samba-technical
mailing list