Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MRG+1] Correct build/test fail with no module names 'tests' #48

Closed
wants to merge 1 commit into from

Conversation

ghantoos
Copy link

When working on the Debian package of parsel, I got the following error, due to the 'tests' module not being found. This commit corrects it.

Traceback (most recent call last):
  File "setup.py", line 54, in <module>
    test_suite='tests',
  File "/usr/lib/python2.7/distutils/core.py", line 151, 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/dist-packages/setuptools/command/test.py", line 159, in run
    self.with_project_on_sys_path(self.run_tests)
  File "/usr/lib/python2.7/dist-packages/setuptools/command/test.py", line 140, in with_project_on_sys_path
    func()
  File "/usr/lib/python2.7/dist-packages/setuptools/command/test.py", line 180, in run_tests
    testRunner=self._resolve_as_ep(self.test_runner),
  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 130, in loadTestsFromNames
    suites = [self.loadTestsFromName(name, module) for name in names]
  File "/usr/lib/python2.7/unittest/loader.py", line 91, in loadTestsFromName
    module = __import__('.'.join(parts_copy))
ImportError: No module named tests
E: pybuild pybuild:274: test: plugin distutils failed with: exit code=1: python2.7 setup.py test 
dh_auto_test: pybuild --test -i python{version} -p 2.7 returned exit code 13

Cheers

@ghantoos ghantoos changed the title Correct build/test fail with no found module 'tests' Correct build/test fail with no module names 'tests' Jul 25, 2016
@redapple
Copy link
Contributor

@ghantoos , thanks for working on packaging for Debian!
We definitely need help on this.
Are you also working on Debian packaging for other scrapy-related projects or scrapy itself?

@ghantoos
Copy link
Author

@redapple yes, I am currently working on updating w3lib, queuelib and scrapy. Which lead me to packaging parsel as scrapy now depends on it: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=832448

I am glad I can help! :)

@codecov-io
Copy link

codecov-io commented Jul 25, 2016

Current coverage is 100% (diff: 100%)

Merging #48 into master will not change coverage

Powered by Codecov. Last update 8eb2df9...094d6f3

@eliasdorneles
Copy link
Member

Hm yea, since we've adopted py.test we're not recommending anyone to run tests with python setup.py test nowadays.
But this is harmless, so +1.

@eliasdorneles eliasdorneles changed the title Correct build/test fail with no module names 'tests' [MRG+1] Correct build/test fail with no module names 'tests' Jul 25, 2016
@kmike
Copy link
Member

kmike commented Jul 25, 2016

http://docs.pytest.org/en/latest/goodpractices.html says

avoid __init__.py files in your test directories. This way your tests can run easily against an installed version of mypkg, independently from the installed package if it contains the tests or not.

I'm not sure if it is a problem for parsel or not.

Why do we have test_suite in setup.py if we don't really support it?

@redapple
Copy link
Contributor

We should be able to follow Integrating with setuptools / python setup.py test / pytest-runner

setup.py

from setuptools import setup

setup(
    #...,
    setup_requires=['pytest-runner', ...],
    tests_require=['pytest', ...],
    #...,
)

setup.cfg

[aliases]
test=pytest

@redapple
Copy link
Contributor

See #49

@eliasdorneles
Copy link
Member

Why do we have test_suite in setup.py if we don't really support it?

That's a leftover from the move to py.test, earlier I toyed with running from setup.py -- I should've removed that earlier.

Thanks @redapple for fixing my mess. =)

@redapple
Copy link
Contributor

redapple commented Jul 26, 2016

@ghantoos , is #49 (now merged) ok for you?
I believe you'll want a new release soon too, right?

@ghantoos
Copy link
Author

@redapple I have applied the patch from #49 and it fixes the test issue. The patch has been integrated in the packaging, and is noted as "Applied-Upstream", so there is no rush to have a new upstream release, unless you were about to do it anyways.

Thanks for your help on this!

@ghantoos ghantoos closed this Jul 26, 2016
@ghantoos
Copy link
Author

@redapple actually, the license issue from #46 is preventing me from uploading the vanilla release to Debian (I have to clone the git repo instead). Do you know when you are planning to release a new version of parsel?

@redapple
Copy link
Contributor

@ghantoos , parsel 1.0.3 has been released just now.
Let us know if you need any further help.

@ghantoos
Copy link
Author

@redapple that's great!! Thanks! :)

@ghantoos
Copy link
Author

The package has been uploaded to the NEW queue [1]. It still needs to be validated before entering the Debian repos. I'll keep you posted.

Have a nice weekend!

[1] https://ftp-master.debian.org/new/python-parsel_1.0.3-1.html

@eliasdorneles
Copy link
Member

Awesome, nice work @ghantoos, thanks !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants