cdent / gabbi

Declarative HTTP Testing for Python and anything else
http://gabbi.readthedocs.org/
Other
148 stars 34 forks source link

remove six dependency #324

Closed a-detiste closed 10 months ago

a-detiste commented 10 months ago

this is a lefotver of Python2 compatibility

cdent commented 10 months ago

Thanks for this, will give it a proper look some time a bit later in the week.

Out of curiosity what prompted you to provide the pull request?

a-detiste commented 10 months ago

Hi,

I'm reviewing random packages that still depends on six (/ needs a hand).

https://wiki.debian.org/Python3-six-removal

I provided once a -1400/+200 PR to a project, I learn new things & have some fun.

a-detiste commented 10 months ago

I find the way the import are sorted completely unnatural.

But now... we have an actual problem to fix(ture) !

cdent commented 10 months ago

But now... we have an actual problem to fix(ture) !

Looks like the fix for that is this:

diff --git a/gabbi/fixture.py b/gabbi/fixture.py
index 4538dee..03b8e10 100644
--- a/gabbi/fixture.py
+++ b/gabbi/fixture.py
@@ -95,4 +95,4 @@ def nest(fixtures):
             except Exception:
                 exc = sys.exc_info()
         if exc != (None, None, None):
-            raise exc[0]
+            raise exc[0](exc[1]).with_traceback(exc[2])
diff --git a/gabbi/tests/test_suite.py b/gabbi/tests/test_suite.py
index d550a4a..e31b0c5 100644
--- a/gabbi/tests/test_suite.py
+++ b/gabbi/tests/test_suite.py
@@ -19,6 +19,7 @@ import unittest
 from gabbi import fixture
 from gabbi import suitemaker

+FIXTURE_METHOD = 'start_fixture'
 VALUE_ERROR = 'value error sentinel'

@@ -54,3 +55,4 @@ class SuiteTest(unittest.TestCase):

         self.assertIn('foo_alpha', str(errored_test))
         self.assertIn(VALUE_ERROR, trace)
+        self.assertIn(FIXTURE_METHOD, trace)

If you're happy with that, please apply that and then I'll merge this and make a new release and we can call this a job very well done.

(Note I haven't checked pep8 on these changes yet...)

(Again, if you don't have the time, let me know and I can do it).

cdent commented 10 months ago

Thanks again!

2.10.0 has been released.