Don't use python 2.7 syntax. Import alternative module for OrderedDicts if available.

#1 Merged
Repository
boukeversteegh
Branch
default
Repository
nicfit
Branch
default
Author
  1. Bouke Versteegh
Reviewers
Description
No description

Comments (3)

  1. Bouke Versteegh author

    argparse is available on 2.6 as well.

    On OSX:

    $ sudo /usr/bin/easy_install-2.6 argparse
    Searching for argparse
    Best match: argparse 1.2.1
    Processing argparse-1.2.1-py2.6.egg
    argparse 1.2.1 is already the active version in easy-install.pth
    
    Using /Library/Python/2.6/site-packages/argparse-1.2.1-py2.6.egg
    Processing dependencies for argparse
    Finished processing dependencies for argparse
    

    I've tested the support as follows. As you can see there are still some errors, but I also get these errors on python2.7.

    How are the tests supposed to be run? If I run nosetest in either src/test or src, it returns many errors that are related to the unittest module itself.

    ERROR: testVersionOutput (test.test_main.ParseCommandLineTest)
    ----------------------------------------------------------------------
    Traceback (most recent call last):
      File "/Users/boukeversteegh/eyed3/src/test/test_main.py", line 52, in testVersionOutput
        args, parser = main.parseCommandLine([arg])
      File "/Users/boukeversteegh/eyed3/src/eyed3/main.py", line 214, in parseCommandLine
        parser = makeParser()
      File "/Users/boukeversteegh/eyed3/src/eyed3/main.py", line 146, in makeParser
        p = ArgumentParser(prog=eyed3.info.NAME, add_help=True)
    AttributeError: 'module' object has no attribute 'NAME'
    ERROR: test.test_plugins.test_load
    ----------------------------------------------------------------------
    Traceback (most recent call last):
      File "/Library/Python/2.6/site-packages/nose-1.2.1-py2.6.egg/nose/case.py", line 197, in runTest
        self.test(*self.arg)
      File "/Users/boukeversteegh/eyed3/src/test/test_plugins.py", line 26, in test_load
        assert_in("classic", plugins.keys())
    NameError: global name 'assert_in' is not defined
    

    So I just ran every python file in src/test, and this is what I get:

    $ cd ~/eyed3/src/eyed3
    $ for py in ~/eyed3/src/test/*.py; do echo $py; PYTHONPATH=~/eyed3/src /usr/bin/python2.6 $py; done
    /Users/boukeversteegh/eyed3/src/test/__init__.py
    /Users/boukeversteegh/eyed3/src/test/test__init__.py
    /Users/boukeversteegh/eyed3/src/test/test_binfuncs.py
    /Users/boukeversteegh/eyed3/src/test/test_classic_plugin.py
    Traceback (most recent call last):
      File "/Users/boukeversteegh/eyed3/src/test/test_classic_plugin.py", line 25, in <module>
        from . import DATA_D, RedirectStdStreams
    ValueError: Attempted relative import in non-package
    /Users/boukeversteegh/eyed3/src/test/test_core.py
    /Users/boukeversteegh/eyed3/src/test/test_main.py
    Traceback (most recent call last):
      File "/Users/boukeversteegh/eyed3/src/test/test_main.py", line 25, in <module>
        from . import RedirectStdStreams
    ValueError: Attempted relative import in non-package
    /Users/boukeversteegh/eyed3/src/test/test_plugins.py
    /Users/boukeversteegh/eyed3/src/test/test_utils.py
    Traceback (most recent call last):
      File "/Users/boukeversteegh/eyed3/src/test/test_utils.py", line 24, in <module>
        from . import RedirectStdStreams
    ValueError: Attempted relative import in non-package
    

    One such error shows up in test/mp3, and test/id3 runs without error.

    I guess it needs further testing, but it seems feasible to support 2.6 without too much trouble..

  2. Travis Shirk repo owner

    Okay, some docs need to be updated. As of now I say no deps are required other than python 2.7. It will be nice to say 2.6 is supported although now argparse is a dep. No big deal.

    python setup.py test (or paver test).. Some tests use mp3 files that are not in the repo.. I have a separate archive for those, but these tests also use the @skip decorator. I do see some failures in my repo at the moment, but the above looks like potential 2.6 vs 2.7 errors (assert_in not found, for example).

    Also, I should get tox running so the tests can run with 2.7 and 2.6.

    I'll mess around with the patch and testing 2.6 ASAP, thanks.