Remove six as a dependency and fix unit tests.

Review Request #9426 — Created Dec. 5, 2017 and submitted

Information

kgb
master
298bad5...

Reviewers

kgb

The dependency on six was problematic, as it was getting imported
during the packaging process by way of kgb/__init__.py importing the
module that imports six, and this was imported by setup.py. That meant
that packaging would fail if six was not already installed. Since we
need so very little from it (iteritems and text_type), we just
define our own wrapper types.

While testing, I noticed my prior change also accidentally broke tests
on Python 3. Those are fixed with this change by importing our
text_type and plugging in its type name in some error messages instead
of assuming they're unicode.

Unit tests pass on Python 2 and 3.

I was able to build a package from a fresh virtualenv.

Description From Last Updated

E731 do not assign a lambda expression, use a def

reviewbotreviewbot

E731 do not assign a lambda expression, use a def

reviewbotreviewbot

In python 3, .items() returns an iterator.

daviddavid
Checks run (1 failed, 1 succeeded)
flake8 failed.
JSHint passed.

flake8

chipx86
david
  1. 
      
  2. kgb/spies.py (Diff revision 2)
     
     
    Show all issues

    In python 3, .items() returns an iterator.

    1. I'm copying what six itself is doing here. I'm not 100% sure on the reasoning, but I'm guessing it's a compatibility fix for some earlier Python 3 versions.

    2. Fair enough.

  3. 
      
david
  1. Ship It!
  2. 
      
chipx86
Review request changed
Status:
Completed
Change Summary:
Pushed to master (c8e60e9)