Jaymon / dsnparse

Easily parse DSN urls (connection strings) in Python
MIT License
21 stars 8 forks source link

make it 2.6 compatible #2

Closed tly1980 closed 7 years ago

tly1980 commented 7 years ago

Hey Jaymon,

I like dsnparse lib and I am using it in a python2.6 environment. And I've done some patch here to make it python2.6 compatible.

Thanks.

Jaymon commented 7 years ago

this looks pretty good. Did you run all the tests with 2.6, 2.7 and 3.5? Did they all pass, if they did I'll go ahead and merge this in.

Also, update setup.py with 2.6 support.

Thank you :)

tly1980 commented 7 years ago
GLOB sdist-make: /Users/minddriven/workspace/dsnparse/setup.py
py26 inst-nodeps: /Users/minddriven/workspace/dsnparse/.tox/dist/dsnparse-0.1.9.zip
py26 installed: DEPRECATION: Python 2.6 is no longer supported by the Python core team, please upgrade your Python. A future version of pip will drop support for Python 2.6,dsnparse==0.1.9
py26 runtests: PYTHONHASHSEED='1896401015'
py26 runtests: commands[0] | python setup.py test
running test
running egg_info
writing dsnparse.egg-info/PKG-INFO
writing top-level names to dsnparse.egg-info/top_level.txt
writing dependency_links to dsnparse.egg-info/dependency_links.txt
reading manifest file 'dsnparse.egg-info/SOURCES.txt'
writing manifest file 'dsnparse.egg-info/SOURCES.txt'
running build_ext
test___getitem__ (dsnparse_test.DsnParseTest) ... ok
test_geturl (dsnparse_test.DsnParseTest) ... ok
test_parse (dsnparse_test.DsnParseTest) ... ERROR
test_parse_abs_path (dsnparse_test.DsnParseTest) ... ok
test_parse_crazy_path (dsnparse_test.DsnParseTest) ... ERROR
test_parse_custom_class (dsnparse_test.DsnParseTest) ... ok
test_parse_environ (dsnparse_test.DsnParseTest) ... ok
test_parse_environs (dsnparse_test.DsnParseTest) ... ok
test_parse_memory (dsnparse_test.DsnParseTest) ... ERROR
test_parse_rel_path (dsnparse_test.DsnParseTest) ... ERROR
test_parse_rel_path_2 (dsnparse_test.DsnParseTest) ... ERROR
test_setdefault (dsnparse_test.DsnParseTest) ... ok
test_unpack (dsnparse_test.DsnParseTest) ... ok

======================================================================
ERROR: test_parse (dsnparse_test.DsnParseTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/minddriven/workspace/dsnparse/dsnparse_test.py", line 140, in test_parse
    with self.assertRaises(ValueError):
TypeError: failUnlessRaises() takes at least 3 arguments (2 given)

======================================================================
ERROR: test_parse_crazy_path (dsnparse_test.DsnParseTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/minddriven/workspace/dsnparse/dsnparse_test.py", line 20, in test_parse_crazy_path
    self.assertIsNone(r.hostname)
AttributeError: 'DsnParseTest' object has no attribute 'assertIsNone'

======================================================================
ERROR: test_parse_memory (dsnparse_test.DsnParseTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/minddriven/workspace/dsnparse/dsnparse_test.py", line 13, in test_parse_memory
    self.assertIsNone(r.hostname)
AttributeError: 'DsnParseTest' object has no attribute 'assertIsNone'

======================================================================
ERROR: test_parse_rel_path (dsnparse_test.DsnParseTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/minddriven/workspace/dsnparse/dsnparse_test.py", line 32, in test_parse_rel_path
    self.assertIsNone(r.hostname)
AttributeError: 'DsnParseTest' object has no attribute 'assertIsNone'

======================================================================
ERROR: test_parse_rel_path_2 (dsnparse_test.DsnParseTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/minddriven/workspace/dsnparse/dsnparse_test.py", line 26, in test_parse_rel_path_2
    self.assertIsNone(r.hostname)
AttributeError: 'DsnParseTest' object has no attribute 'assertIsNone'

----------------------------------------------------------------------
Ran 13 tests in 0.004s
tly1980 commented 7 years ago

This one should fix the broken test cases.

make tox
...
...

  py26: commands succeeded
  py27: commands succeeded
  py35: commands succeeded
  congratulations :)
Jaymon commented 7 years ago

I think this looks good, last thing remaining is I don't really want the README.rst file in the repo, it's too confusing to have 2 of them and README.md is the fountain of truth, so the workflow should be to create the README.rst before doing something with setup.py and then removing it like you do with build/ and dist/ in the Makefile.

tly1980 commented 7 years ago

README.rst is removed and it is added to .gitignore.

Jaymon commented 7 years ago

🙌 Thank you for the pull request, I pushed v0.1.10 to pypi with your changes :)