#378 Refine test runner for py26
Merged 5 years ago by cqi. Opened 5 years ago by cqi.

file modified
+1
@@ -18,6 +18,7 @@ 

  htmlcov/

  /.eggs/

  .env/

+ .py26env/

  

  doc/build/

  doc/source/cli.rst

file added
+24
@@ -0,0 +1,24 @@ 

+ ifdef IGNORE_PY26

+ 	default_targets=detox

+ else

+ 	default_targets=py26-test detox

+ endif

+ 

+ test: $(default_targets)

+ .PHONY: test

+ 

+ py26-test:

+ 	@virtualenv --python=python2.6 .py26env

+ 	@.py26env/bin/pip install tox

+ 	@.py26env/bin/tox -e py26

+ .PHONY: py26-test

+ 

+ detox:

+ 	@detox -e py27,py36,py37,flake8

+ .PHONY: detox

+ 

+ tox:

+ 	@python3 -m venv .env

+ 	@.env/bin/pip install tox

+ 	@.env/bin/tox -e py27,py36,py37,flake8

+ .PHONY: tox

file modified
+7 -10
@@ -74,20 +74,17 @@ 

  Run Tests

  ---------

  

- Before make a pull request, ensure local changes pass all test cases. There

- are two choices to run tests.

+ Before make a pull request, ensure local changes pass all test cases.

  

- * Run tests in parallel with ``detox``. Newer version of ``detox`` does not

-   support ``py26``. You can run rest of test environments::

+ Before run tests, install these packages::

  

-     detox -e py27,py36,py37,flake8

+     sudo dnf install python26 python37 detox python2-virtualenv

  

- * Run tests inside a Python environment with ``tox``::

+ To run tests simply, ``make test``.

  

-     python3 -m venv env

-     source env/bin/activate

-     pip install tox

-     tox

+ By default, target ``test`` runs tests with all supported Python versions.

+ However, if you look into ``Makefile``, there is still a target ``tox`` that

+ allows developer to run tests with test environments one by one.

  

  More Information

  ================

file modified
+6 -3
@@ -12,9 +12,12 @@ 

      PYCURL_SSL_LIBRARY=openssl

  

  [testenv:py26]

- commands =

-     pip install -I "setuptools<37.0.0" "wheel<0.30.0" unittest2

-     {[testenv]commands}

+ deps =

+     # Requirement path: koji -> pyOpenSSL

+     # Since this version, Python 2.6 support has been dropped.

+     pyOpenSSL<18.0.0

+     unittest2

+     {[testenv]deps}

  

  [testenv:flake8]

  basepython = python3

Dependent tools to run tests do not support Python 2.6 recently, like
tox, that causes tox -e py26 fails to create a virtual environment
with python2.6 interpreter.

This patch uses a Makefile to create a Python 2.6 environment with
virtualenv manually and to organize steps to run tests with Python 2.6
and other Python versions in only one command make test.

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

rebased onto 4a30662a5b2dde82aa83fd27d1934e5648b2ddbb

5 years ago

I'm getting this:

$ make test
Running virtualenv with interpreter /usr/bin/python2.6
ERROR: None
ERROR: this script requires Python 2.7 or greater.
make: *** [Makefile:5: py26-test] Error 101

The only thing In the py26env is tox. Why can't system version be used?

I run it and it works (with proper packages installed before).

rebased onto 92446c172c18f0add570c7dea0ff895000b6e3d8

5 years ago

Updated to allow ignore python26 by setting an environment variable. This could be useful for rpkg for a while before python26 is installed back into slave.

Pretty please pagure-ci rebuild

After updating python2-virtualenv make test works on my machine. :thumbsup:

rebased onto 77c133c

5 years ago

What is the right scenario (or correct command)?

[root@a3dfffed40a3 rpkg]# make test IGNORE_PY26=1
detox: invalid option -- 'e'
usage: detox [-hLnrvV] [-f configfile] [-s sequence] [--dry-run] [--inline] [--special]
      file [file ...]

otherwise (without IGNORE_PY26) it runs well and creates py26 virtual environment.

@onosek Based on my experience of make, command should be

IGNORE_PY26=1 make test

@cqi I am affraid output is completely same (I tried it previously).

@onosek Is it python2-detox-0.12-1.fc27.noarch?

actually detox-1.3.0-4.fc28.x86_64 was installed there. I replaced it with python2-detox-0.11-5.fc28.noarch and python3-detox-0.12-2.fc28.noarch respectively. Command make test IGNORE_PY26=1 is identical in my point of view. It works now - on docker container containing python3 packages it works completely. On docker container for testing python2 version of rpkg it works only when .tox directory and its content was already created.
But it is sufficient for me. Can be merged as per me. Thanks

Pull-Request has been merged by cqi

5 years ago