#381 Refine tox and Makefile
Merged by cqi. Opened by cqi.
cqi/rpkg refine-tox  into  master

Download 381.patch

Two commits to improve dependency list, tox and Makefile

1) Allow to pass posargs to tox from make

2) Specify dependent packages in one place

setup.py is the place to inject dependent packages, both install or
tests. All the packages are read from pip requirements files pypi.txt
and test-pypi.txt, then modified and packages specific for Python 2.6 are
added in setup.py.

tox.ini is updated accordingly as well. Major changes are:

  • some deeper dependent packages, which have dropped Python 2.6 support,
    are listed for py26 specificially.
  • instead of enabling tox config usedevelop, install dependent packages
    listed in setup.py by pip -e option.
  • run tests by setup.py nosetests which can install packages listed in
    tests_require.

As a result, dependent packages for all supported Python versions should
be added to pypi.txt, which will be in install_requires eventually.
Any packages specific to Python 2.6 or not should be listed in setup.py
explicitly.

Signed-off-by: Chenxiong Qi cqi@redhat.com

Pretty please pagure-ci rebuild

Everything goes well except tox -e py26:

...
ERROR: test_target (test_commands.TestProperties)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/root/src/rpkg/tests/test_commands.py", line 398, in test_target
    self.checkout_branch(cmd.repo, 'eng-rhel-6')
  File "/root/src/rpkg/tests/utils.py", line 252, in checkout_branch
    heads = [head for head in repo.heads if head.name == branch_name]
  File "/root/src/rpkg/.eggs/GitPython-0.3.7-py2.6.egg/git/repo/base.py", line 237, in heads
    return Head.list_items(self)
  File "/root/src/rpkg/.eggs/GitPython-0.3.7-py2.6.egg/git/util.py", line 714, in list_items
    out_list.extend(cls.iter_items(repo, *args, **kwargs))
  File "/root/src/rpkg/.eggs/GitPython-0.3.7-py2.6.egg/git/refs/symbolic.py", line 594, in _iter_items
    for sha, rela_path in cls._iter_packed_refs(repo):
  File "/root/src/rpkg/.eggs/GitPython-0.3.7-py2.6.egg/git/refs/symbolic.py", line 98, in _iter_packed_refs
    raise TypeError("PackingType of packed-Refs not understood: %r" % line)
TypeError: PackingType of packed-Refs not understood: '# pack-refs with: peeled fully-peeled sorted'
...

Although this works well:

root@8c4c495231b8 rpkg]# cd .py26env/
[root@8c4c495231b8 .py26env]# source bin/activate
(.py26env) [root@8c4c495231b8 .py26env]# cd ..
(.py26env) [root@8c4c495231b8 rpkg]# nosetests-3
...
(.py26env) [root@8c4c495231b8 rpkg]# rpm -qa | grep GitPython
python3-GitPython-2.1.11-1.fc28.noarch

@onosek From which environment do you run tox -e py26? I doubt it is relative this this change.

Why there is nosetests-3 in .py26env?

Does make test work in your system?

make test fails and I think that tox -e py26 is the command it fails on. I run in docker environment (both python2/3), not in virtual.
You are right, nosetests-3 shouldn't be correct variant. But both nosetests and nosetests-3 works in that case.
But it is probably not directly related to this PR, so let's merge it and I will hopefully resolve problem later.

@onosek Ok. Jenkins job has been updated to use this new Makefile. Sorry, I couldn't figure out why tox -e py26 fails in your environment in that way.

rebased onto c4fde819831bba1c4c36a1e4b9f607aec07f4d8e

This is rebased on master. Please review again.

Looks good to me. Running detox the tests pass for me. :thumbsup:

Pull-Request has been merged by cqi

I did testing on Friday, but haven't write summary here until now (I was interrupted). So just for information:

On Pythonn3 docker machine:

pip3 install --user detox
yum install gobject-introspection-devel cairo-gobject-devel
~/.local/bin/detox -e py36,py37,flake8
~/.local/bin/tox -e py36,py37,flake8

On Python2 docker machine

pip install --user detox
yum install gobject-introspection-devel cairo-gobject-devel
~/.local/bin/detox -e py26,py27,flake8
~/.local/bin/tox -e py26,py27,flake8

Both detox commands produce a lot of tracebacks but write "succeeded" in the end.

The first run of tox displays:

  Try installing it with: 'sudo dnf install cairo-devel'
  ----------------------------------------
  Failed building wheel for PyGObject

But it passes. The second run is without this message. Maybe there is some problem in import order. Anyway, I would confirm this PR on Friday.

Metadata