Re: [PATCH 44/50] tests: Modify sigma_dut test sets for python3

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 2019-01-25 at 11:26 +0100, Johannes Berg wrote:
> On Thu, 2019-01-24 at 16:46 +0900, Masashi Honma wrote:
> > Signed-off-by: Masashi Honma <masashi.honma@xxxxxxxxx>
> > ---
> >  tests/hwsim/test_sigma_dut.py | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/tests/hwsim/test_sigma_dut.py b/tests/hwsim/test_sigma_dut.py
> > index 3641a9dcf..7f733ef6f 100644
> > --- a/tests/hwsim/test_sigma_dut.py
> > +++ b/tests/hwsim/test_sigma_dut.py
> > @@ -1607,7 +1607,7 @@ def test_sigma_dut_ap_dpp_qr(dev, apdev, params):
> >  def test_sigma_dut_ap_dpp_qr_legacy(dev, apdev, params):
> >      """sigma_dut controlled AP (legacy)"""
> >      run_sigma_dut_ap_dpp_qr(dev, apdev, params, "ap-psk", "sta-psk",
> > -                            extra="pass=%s" % "qwertyuiop".encode("hex"))
> > +                            extra="pass=%s" % binascii.hexlify("qwertyuiop".encode()).decode())
> 
> IMHO all those "constant".encode() you have in the whole series would be
> much better written as b"constant". I'm pretty sure that works on all
> relevant python 2 versions (it certainly does on mine)

Similarly, bytes() is better as b'' I think.

And maybe we should think about making everything bytes throughout. You
have a LOT of things like this here, where you do

extra="pass=%s" % binascii.hexlify("qwertyuiop".encode()).decode()

If we expected extra to instead be bytes (rather than string), we'd just
have

extra=b"pass=%s" % binascii.hexlify(b"qwertyuiop")

which IMHO is way more readable.

johannes


_______________________________________________
Hostap mailing list
Hostap@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/hostap



[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux