python2 setup.py test : AttributeError: 'module' object has no attribute 'test_models'

1,214 views
Skip to first unread message

Dieter Plaetinck

unread,
Mar 28, 2011, 6:37:40 AM3/28/11
to gensim
Hello fellow gensimmers,
I noticed the latest master branch breaks when running the test suite.
I run Python 2.7.1 (I know, in principle this version is not "supported" but I've been using this same version for months with gensim without issues)
Anyone knows what could be the issue at hand?

12:28:47 dieter@Gi tmp git clone git://github.com/piskvorky/gensim.git
Cloning into gensim...
remote: Counting objects: 5014, done.
remote: Compressing objects: 100% (1611/1611), done.
remote: Total 5014 (delta 3539), reused 4361 (delta 3076)
Receiving objects: 100% (5014/5014), 5.40 MiB | 2.88 MiB/s, done.
Resolving deltas: 100% (3539/3539), done.
12:28:53 dieter@Gi tmp cd gensim
12:28:55 dieter@Gi gensim develop git checkout master
Branch master set up to track remote branch master from origin.
Switched to a new branch 'master'

# the following is needed because on Arch Linux "python" is python3, so we point to python2 explicitly.
12:28:58 dieter@Gi gensim master   for file in $(find . -name '*.py' -print); do
 >      sed -i 's_^#!.*/usr/bin/python_#!/usr/bin/python2_' $file
 >      sed -i 's_^#!.*/usr/bin/env.*python_#!/usr/bin/env python2_' $file
 >   done

# I actually verify that the above sed changes have been applied correctly on all python files.
# using: find . -name '*.py' -print | xargs head -n 1
# and i've always applied this fix on gensim anytime I updated it in the past (which happened a few times)

12:29:48 dieter@Gi gensim master ? python2 setup.py test                      
running test                                       
running egg_info
creating src/gensim.egg-info
writing requirements to src/gensim.egg-info/requires.txt
writing src/gensim.egg-info/PKG-INFO
writing top-level names to src/gensim.egg-info/top_level.txt
writing dependency_links to src/gensim.egg-info/dependency_links.txt
writing manifest file 'src/gensim.egg-info/SOURCES.txt'
reading manifest file 'src/gensim.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'src/gensim.egg-info/SOURCES.txt'
running build_ext
Traceback (most recent call last):
  File "setup.py", line 76, in <module>
    include_package_data = True,
  File "/usr/lib/python2.7/distutils/core.py", line 152, in setup
    dist.run_commands()
  File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands
    self.run_command(cmd)
  File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/usr/lib/python2.7/site-packages/setuptools/command/test.py", line 137, in run
    self.with_project_on_sys_path(self.run_tests)
  File "/usr/lib/python2.7/site-packages/setuptools/command/test.py", line 117, in with_project_on_sys_path
    func()
  File "/usr/lib/python2.7/site-packages/setuptools/command/test.py", line 146, in run_tests
    testLoader = loader_class()
  File "/usr/lib/python2.7/unittest/main.py", line 94, in __init__
    self.parseArgs(argv)
  File "/usr/lib/python2.7/unittest/main.py", line 149, in parseArgs
    self.createTests()
  File "/usr/lib/python2.7/unittest/main.py", line 158, in createTests
    self.module)
  File "/usr/lib/python2.7/unittest/loader.py", line 128, in loadTestsFromNames
    suites = [self.loadTestsFromName(name, module) for name in names]
  File "/usr/lib/python2.7/unittest/loader.py", line 103, in loadTestsFromName
    return self.loadTestsFromModule(obj)
  File "/usr/lib/python2.7/site-packages/setuptools/command/test.py", line 34, in loadTestsFromModule
    tests.append(self.loadTestsFromName(submodule))
  File "/usr/lib/python2.7/unittest/loader.py", line 100, in loadTestsFromName
    parent, obj = obj, getattr(obj, part)
AttributeError: 'module' object has no attribute 'test_models'

Radim

unread,
Mar 28, 2011, 9:19:29 AM3/28/11
to gensim
Hmm, the only new change I'm aware of is that the unit test files
don't have the executable flag anymore (+x was breaking nose tests,
Stephan reported). And that there's more of them.

Though I don't see how that could affect your tests.

I regularly check on OS X + on Windows, no problem there (py2.5 and
2.6). Many users are using Python 2.7 too (it is supported). Can
anyone please verify these exceptions? Dieter, what happens if you
symlink `python` to python2.7, instead of modifying the source files?

Cheers,
Radim

Dieter Plaetinck

unread,
Mar 28, 2011, 10:48:36 AM3/28/11
to gen...@googlegroups.com
On Mon, Mar 28, 2011 at 3:19 PM, Radim <radimr...@seznam.cz> wrote:
Hmm, the only new change I'm aware of is that the unit test files
don't have the executable flag anymore (+x was breaking nose tests,
Stephan reported). And that there's more of them.

Though I don't see how that could affect your tests.

I regularly check on OS X + on Windows, no problem there (py2.5 and
2.6). Many users are using Python 2.7 too (it is supported). Can
anyone please verify these exceptions? Dieter, what happens if you
symlink `python` to python2.7, instead of modifying the source files?
 
exactly the same. alas..
I also tried `chmod +x src/gensim/test/test_*.py` to no avail.

Dieter
Reply all
Reply to author
Forward
0 new messages