#36 Working on a test suite.
Merged by mikem. Opened by ralph.
ralph/koji test-stubbery  into  master

Download 36.patch
no initial comment

I added a new make target: make test which runs nosetests and should produce a coverage report. For that to work, you'll need to install some new deps like: sudo dnf install python-nose python-coverage python-mock

I'd like to add those to the docs, but they seem to be hung up in #2.

So, maybe it goes without saying, but these tests are about the furthest thing from comprehensive. I just set up the new make target and started running the tests and adding new coverage for a stretch of free time in an afternoon. We should by all means consider this a long-term project to get some "good" tests in there.

I'm going to stop here and (pending review) call this first stab "done". If we can merge it, we can come back later and add more tests over time.

make test failing on F22 with
ERROR: Failure: OSError ([Errno 2] No such file or directory: '--with-coverage')

# rpm -q python-nose python-coverage python-mock
python-nose-1.3.7-4.fc22.noarch
python-coverage-4.0.3-1.fc22.x86_64
python-mock-1.0.1-7.fc22.noarch

...and for good measure

python-nose-cov-1.6-2.fc22.noarch
python-nose-cover3-0.1.0-8.fc21.noarch

What am I missing?

Does any traceback get printed out?

And, if you just execute nosetests with no arguments, what output do you get?

Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/nose/loader.py", line 418, in loadTestsFromName
    addr.filename, addr.module)
  File "/usr/lib/python2.7/site-packages/nose/importer.py", line 47, in importFromPath
    return self.importFromDir(dir_path, fqname)
  File "/usr/lib/python2.7/site-packages/nose/importer.py", line 94, in importFromDir
    mod = load_module(part_fqname, fh, filename, desc)
  File "/home/mike/Devel/koji/koji/upload_test.py", line 12, in 
    s.uploadWrapper(sys.argv[1], sys.argv[2], callback=callback, blocksize=512)
  File "/home/mike/Devel/koji/koji/koji/__init__.py", line 2108, in uploadWrapper
    self.fastUpload(localfile, path, name, callback, blocksize, overwrite)
  File "/home/mike/Devel/koji/koji/koji/__init__.py", line 2024, in fastUpload
    size = os.stat(localfile).st_size

Ah, I see the problem. I had a stray file named upload_test.py in my checkout, but it is not a proper unit test and seems to confuse nose

So, looks like a good start. Can you rebase it?

Pull-Request has been rebased

@mikem, rebase done. :)

Pull-Request has been merged by mikem

Metadata