#8 Allow to fetch test dependencies from tox and run tox tests
Closed 4 years ago by pviktori. Opened 4 years ago by churchyard.
rpms/ churchyard/pyproject-rpm-macros tox  into  master

file modified
+72 -3
@@ -55,6 +55,78 @@ 

      %generate_buildrequires

      %pyproject_buildrequires -r -x testing

  

+ For projects that specify test requirements in their [tox] configuration,

+ these can be added using the `-t` flag (default tox environment)

+ or the `-e` flag followed by the tox environment.

+ The default tox environment (such as `py37` assuming the Fedora's Python version is 3.7)

+ is available in the `%{toxenv}` macro.

+ For example, if upstream suggests running the tests on Python 3.7 with `tox -e py37`,

+ the test deps would be generated by:

+ 

+     %generate_buildrequires

+     %pyproject_buildrequires -t

+ 

+ If upstream uses a custom derived environment, such as `py37-unit`, use:

+ 

+     %pyproject_buildrequires -e %{toxenv}-unit

+ 

+ Or specify more environments if needed:

+ 

+     %pyproject_buildrequires -e %{toxenv}-unit,%{toxenv}-integration

+ 

+ The `-e` option redefines `%{toxenv}` for further reuse.

+ Use `%{default_toxenv}` to get the default value.

+ 

+ Note that `-t` implies `-r`, because tox normally assumes the package is installed

+ including all the runtime dependencies.

+ 

+ The `-t`/`-e` option uses [tox-current-env]'s `--print-deps-to-file` behind the scenes.

+ 

+ [tox]: https://tox.readthedocs.io/

+ [tox-current-env]: https://github.com/fedora-python/tox-current-env/

+ 

+ 

+ Running tox based tests

+ -----------------------

+ 

+ In case you want to run the tests as specified in [tox] configuration,

+ you can use the `%tox` macro:

+ 

+     %check

+     %tox

+ 

+ The macro:

+ 

+  - Always prepends `$PATH` with `%{buildroot}%{_bindir}`

+  - If not defined, sets `$PYTHONPATH` to `%{buildroot}%{python3_sitearch}:%{buildroot}%{python3_sitelib}`

+  - If not defined, sets `$TOX_TESTENV_PASSENV` to `*`

+  - Runs `tox` with `-q` (quiet), `--recreate` and `--current-env` (from [tox-current-env]) flags

+  - Implicitly uses the tox environment name stored in `%{toxenv}` - as overridden by `%pyproject_buildrequires -t`

+ 

+ By using the `-e` flag, you can use a different tox environment(s):

+ 

+     %check

+     %tox

+     %if %{with integration_test}

+     %tox -e % {default_toxenv}-integration

+     %endif

+ 

+ If you wish to provide custom `tox` flags or arguments, add them after `--`:

+ 

+     %tox -- --flag-for-tox

+ 

+ If you wish to pass custom `posargs` to tox, use another `--`:

+ 

+     %tox -- --flag-for-tox -- --flag-for-posargs

+ 

+ Or (note the two sequential `--`s):

+ 

+     %tox -- -- --flag-for-posargs

+ 

+ **Warning:** This macro assumes you have used `%pyproject_buildrequires -t` or `-e`

+ in `%generate_buildrequires`. If not, you need to add:

+ 

+     BuildRequires: python3dist(tox-current-env)

  

  Limitations

  -----------
@@ -64,9 +136,6 @@ 

  This macro changes shebang lines of every Python script in `%{buildroot}%{_bindir}` to `#! %{__python3} %{py3_shbang_opt}` (`#! /usr/bin/python3 -s`).

  We plan to preserve existing Python flags in shebangs, but the work is not yet finished.

  

- The PEPs don't (yet) define a way to specify test dependencies and test runners.

- That means you still need to handle test dependencies and `%check` on your own.

- 

  Extras are currently ignored.

  

  Some valid Python version specifiers are not supported.

file modified
+13 -2
@@ -17,7 +17,11 @@ 

  fi

  }

  

- %pyproject_buildrequires(rx:) %{expand:\\\

+ %default_toxenv py%{python3_version_nodots}

+ %toxenv %{default_toxenv}

+ 

+ %pyproject_buildrequires(rxte:) %{expand:\\\

+ %{-e:%{expand:%global toxenv %{-e*}}}

  echo 'python3-devel'

  echo 'python3dist(packaging)'

  echo 'python3dist(pip) >= 19'
@@ -25,6 +29,13 @@ 

  # setuptools assumes no pre-existing dist-info

  rm -rfv *.dist-info/

  if [ -f %{__python3} ]; then

-   %{__python3} -I %{_rpmconfigdir}/redhat/pyproject_buildrequires.py %{?**}

+   RPM_TOXENV="%{toxenv}" %{__python3} -I %{_rpmconfigdir}/redhat/pyproject_buildrequires.py %{?**}

  fi

  }

+ 

+ %tox(e:) %{expand:\\\

+ TOX_TESTENV_PASSENV="${TOX_TESTENV_PASSENV:-*}" \\

+ PATH="%{buildroot}%{_bindir}:$PATH" \\

+ PYTHONPATH="${PYTHONPATH:-%{buildroot}%{python3_sitearch}:%{buildroot}%{python3_sitelib}}" \\

+ tox --current-env -q --recreate -e "%{-e:%{-e*}}%{!-e:%{toxenv}}" %{?*}

+ }

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

  

  # Keep the version at zero and increment only release

  Version:        0

- Release:        4%{?dist}

+ Release:        5%{?dist}

  

  Source0:        macros.pyproject

  Source1:        pyproject_buildrequires.py
@@ -35,6 +35,7 @@ 

  BuildRequires: python3dist(pytoml)

  BuildRequires: python3dist(pip)

  BuildRequires: python3dist(setuptools)

+ BuildRequires: python3dist(tox-current-env) >= 0.0.2

  BuildRequires: python3dist(wheel)

  %endif

  
@@ -75,6 +76,10 @@ 

  %license LICENSE

  

  %changelog

+ * Fri Jul 26 2019 Miro Hrončok <mhroncok@redhat.com> - 0-5

+ - Allow to fetch test dependencies from tox

+ - Add %%tox macro to invoke tests

+ 

  * Fri Jul 26 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0-4

  - Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild

  

file modified
+39 -6
@@ -1,3 +1,4 @@ 

+ import os

  import sys

  import importlib

  import argparse
@@ -8,6 +9,7 @@ 

  import subprocess

  import pathlib

  import re

+ import tempfile

  import email.parser

  

  print_err = functools.partial(print, file=sys.stderr)
@@ -174,6 +176,23 @@ 

          requirements.extend(requires, source=f'wheel metadata: {key}')

  

  

+ def generate_tox_requirements(toxenv, requirements):

+     requirements.add('tox-current-env >= 0.0.2', source='tox itself')

+     requirements.check(source='tox itself')

+     with tempfile.NamedTemporaryFile('r') as depfile:

+         r = subprocess.run(

+             ['tox', '--print-deps-to-file', depfile.name, '-qre', toxenv],

+             check=True,

+             encoding='utf-8',

+             stdout=subprocess.PIPE,

+             stderr=subprocess.STDOUT,

+         )

+         if r.stdout:

+             print_err(r.stdout)

+         requirements.extend(depfile.read().splitlines(),

+                             source=f'tox --print-deps-only: {toxenv}')

+ 

+ 

  def python3dist(name, op=None, version=None):

      if op is None:

          if version is not None:
@@ -191,6 +210,9 @@ 

      try:

          backend = get_backend(requirements)

          generate_build_requirements(backend, requirements)

+         if toxenv is not None:

+             include_runtime = True

+             generate_tox_requirements(toxenv, requirements)

          if include_runtime:

              generate_run_requirements(backend, requirements)

      except EndPass:
@@ -206,9 +228,14 @@ 

          help='Generate run-time requirements',

      )

      parser.add_argument(

-         '-t', '--toxenv', metavar='TOXENVS',

-         help='generate test tequirements from tox environment '

-             + '(not implemented; implies --runtime)',

+         '-e', '--toxenv', metavar='TOXENVS', default=None,

+         help=('specify tox environments'

+               '(implies --tox)'),

+     )

+     parser.add_argument(

+         '-t', '--tox', action='store_true',

+         help=('generate test tequirements from tox environment '

+               '(implies --runtime)'),

      )

      parser.add_argument(

          '-x', '--extras', metavar='EXTRAS', default='',
@@ -219,10 +246,15 @@ 

      )

  

      args = parser.parse_args(argv)

+ 

      if args.toxenv:

+         args.tox = True

+ 

+     if args.tox:

          args.runtime = True

-         print_err('-t (--toxenv) is not implemented')

-         exit(1)

+         args.toxenv = (args.toxenv or os.getenv('RPM_TOXENV') or

+                        f'py{sys.version_info.major}{sys.version_info.minor}')

+ 

      if args.extras and not args.runtime:

          print_err('-x (--extras) are only useful with -r (--runtime)')

          exit(1)
@@ -238,9 +270,10 @@ 

          generate_requires(

              freeze_output,

              include_runtime=args.runtime,

+             toxenv=args.toxenv,

              extras=args.extras,

          )

-     except Exception as e:

+     except Exception:

          # Log the traceback explicitly (it's useful debug info)

          traceback.print_exc()

          exit(1)

@@ -22,17 +22,16 @@ 

      if case.get('xfail'):

          pytest.xfail(case.get('xfail'))

  

-     if 'pyproject.toml' in case:

-         cwd.joinpath('pyproject.toml').write_text(case['pyproject.toml'])

- 

-     if 'setup.py' in case:

-         cwd.joinpath('setup.py').write_text(case['setup.py'])

+     for filename in 'pyproject.toml', 'setup.py', 'tox.ini':

+         if filename in case:

+             cwd.joinpath(filename).write_text(case[filename])

  

      try:

          generate_requires(

              case['freeze_output'],

              include_runtime=case.get('include_runtime', False),

              extras=case.get('extras', ''),

+             toxenv=case.get('toxenv', None),

          )

      except SystemExit as e:

          assert e.code == case['result']

file modified
+33
@@ -252,3 +252,36 @@ 

      python3dist(dep3)

      python3dist(dep4)

    result: 0

+ 

+ Tox depndencies:

+   freeze_output: |

+     setuptools==50

+     wheel==1

+     tox==3.5.3

+     tox-current-env==0.0.2

+   toxenv: py3

+   setup.py: |

+     from setuptools import setup

+     setup(

+         name='test',

+         version='0.1',

+         install_requires=['inst'],

+     )

+   tox.ini: |

+     [tox]

+     envlist = py36,py37,py38

+     [testenv]

+     deps =

+         toxdep1

+         toxdep2

+     commands =

+         true

+   expected: |

+     python3dist(setuptools) >= 40.8

+     python3dist(wheel)

+     python3dist(wheel)

+     python3dist(tox-current-env) >= 0.0.2

+     python3dist(toxdep1)

+     python3dist(toxdep2)

+     python3dist(inst)

+   result: 0

@@ -0,0 +1,50 @@ 

+ %global pypi_name pluggy

+ Name:           python-%{pypi_name}

+ Version:        0.12.0

+ Release:        1%{?dist}

+ Summary:        The plugin manager stripped of pytest specific details

+ 

+ License:        MIT

+ URL:            https://github.com/pytest-dev/pluggy

+ Source0:        %{pypi_source}

+ 

+ BuildArch:      noarch

+ BuildRequires:  pyproject-rpm-macros

+ 

+ %description

+ %{summary}.

+ 

+ 

+ %package -n python3-%{pypi_name}

+ Summary:        %{summary}

+ %{?python_provide:%python_provide python3-%{pypi_name}}

+ 

+ %description -n python3-%{pypi_name}

+ %{summary}.

+ 

+ 

+ %prep

+ %autosetup -p1 -n %{pypi_name}-%{version}

+ 

+ 

+ %generate_buildrequires

+ %pyproject_buildrequires -e %{toxenv}-pytestrelease

+ 

+ 

+ %build

+ %pyproject_wheel

+ 

+ 

+ %install

+ %pyproject_install

+ 

+ 

+ %check

+ %tox

+ 

+ 

+ %files -n python3-%{pypi_name}

+ %doc README.rst

+ %license LICENSE

+ %{python3_sitelib}/%{pypi_name}/

+ %{python3_sitelib}/%{pypi_name}-%{version}.dist-info/

file modified
+2 -3
@@ -27,7 +27,7 @@ 

  

  

  %generate_buildrequires

- %pyproject_buildrequires -r -x testing

+ %pyproject_buildrequires -x testing -t

  

  

  %build
@@ -40,8 +40,7 @@ 

  %check

  # Only run one test (which uses a test-only dependency, hypothesis).

  # (Unfortunately, some other tests still fail.)

- export PYTHONPATH=%{buildroot}%{python3_sitelib}

- %{__python3} -m pytest -k metafunc

+ %tox -- -- -k metafunc

  

  

  %files -n python3-%{pypi_name}

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

      - entrypoints:

          dir: .

          run: ./mocktest.sh python-entrypoints

+     - pluggy:

+         dir: .

+         run: ./mocktest.sh python-pluggy

      required_packages:

      - mock

      - rpmdevtools

TODO: Figure out how to make -t %{toxenv} the default when -t is used without argument. (Not necessarily blocks this PR.)

rebased onto 8a60635

4 years ago

1 new commit added

  • Define and save %toxenv for further use
4 years ago

3 new commits added

  • Add %tox macro to invoke tests
  • Define and save %toxenv for further use
  • Allow to fetch test dependencies from tox
4 years ago

Now this is funny. When building enclosed python-pluggy, I get nonfatal errors:

Executing(%generate_buildrequires): /bin/sh -e /var/tmp/rpm-tmp.ZC3Dwt
+ umask 022
+ cd /builddir/build/BUILD
+ cd pluggy-0.12.0
+ echo python3-devel
+ echo 'python3dist(packaging)'
+ echo 'python3dist(pip) >= 19'
+ echo 'python3dist(pytoml)'
+ rm -rfv '*.dist-info/'
+ '[' -f /usr/bin/python3 ']'
+ /usr/bin/python3 -I /usr/lib/rpm/redhat/pyproject_buildrequires.py -t py37-pytestrelease
Handling setuptools from build-system.requires
Requirement satisfied: setuptools
   (installed: setuptools 41.0.1)
Handling setuptools-scm from build-system.requires
Requirement satisfied: setuptools-scm
   (installed: setuptools-scm 3.3.3)
Handling wheel from build-system.requires
Requirement satisfied: wheel
   (installed: wheel 0.33.1)
Handling setuptools >= 40.8 from default build backend
Requirement satisfied: setuptools >= 40.8
   (installed: setuptools 41.0.1)
Handling wheel from default build backend
Requirement satisfied: wheel
   (installed: wheel 0.33.1)
Handling wheel from get_requires_for_build_wheel
Requirement satisfied: wheel
   (installed: wheel 0.33.1)
Handling setuptools-scm from get_requires_for_build_wheel
Requirement satisfied: setuptools-scm
   (installed: setuptools-scm 3.3.3)
Handling tox-current-env from tox itself
Requirement satisfied: tox-current-env
   (installed: tox-current-env 0.0.1)
Handling pytest from tox --print-deps-only: py37-pytestrelease
Requirement satisfied: pytest
   (installed: pytest 4.6.4)
warning: no files found matching 'CHANGELOG'
warning: no previously-included files matching '*.pyc' found under directory '*'
warning: no previously-included files matching '*.pyo' found under directory '*'
HOOK STDOUT: running dist_info
HOOK STDOUT: creating pluggy.egg-info
HOOK STDOUT: writing pluggy.egg-info/PKG-INFO
HOOK STDOUT: writing dependency_links to pluggy.egg-info/dependency_links.txt
HOOK STDOUT: writing requirements to pluggy.egg-info/requires.txt
HOOK STDOUT: writing top-level names to pluggy.egg-info/top_level.txt
HOOK STDOUT: writing manifest file 'pluggy.egg-info/SOURCES.txt'
HOOK STDOUT: reading manifest file 'pluggy.egg-info/SOURCES.txt'
HOOK STDOUT: reading manifest template 'MANIFEST.in'
HOOK STDOUT: writing manifest file 'pluggy.egg-info/SOURCES.txt'
HOOK STDOUT: creating '/builddir/build/BUILD/pluggy-0.12.0/pluggy.dist-info'
Handling importlib-metadata (>=0.12) from wheel metadata: Requires-Dist
Requirement satisfied: importlib-metadata (>=0.12)
   (installed: importlib-metadata 0.18)
Handling pre-commit ; extra == 'dev' from wheel metadata: Requires-Dist
Ignoring alien requirement: pre-commit ; extra == 'dev'
Handling tox ; extra == 'dev' from wheel metadata: Requires-Dist
Ignoring alien requirement: tox ; extra == 'dev'
+ RPM_EC=0
++ jobs -p
+ exit 0
python3-devel
python3dist(packaging)
python3dist(pip) >= 19
python3dist(pytoml)
python3dist(setuptools)
python3dist(setuptools-scm)
python3dist(wheel)
python3dist(setuptools) >= 40.8
python3dist(wheel)
python3dist(wheel)
python3dist(setuptools-scm)
python3dist(tox-current-env)
python3dist(pytest)
python3dist(importlib-metadata) >= 0.12
Wrote: /builddir/build/SRPMS/python-pluggy-0.12.0-1.fc31.buildreqs.nosrc.rpm
INFO: Dynamic buildrequires detected
INFO: Going to install missing buildrequires
Failed loading plugin "py3query": No module named 'taskotron_python_versions'
fedora                                                                            24 kB/s |  13 kB     00:00    
fedora                                                                           873 kB/s | 1.6 MB     00:01    
local                                                                            6.7 kB/s | 3.8 kB     00:00    
Package pyproject-rpm-macros-0-5.fc31.noarch is already installed.
Package python3-devel-3.7.4-3.fc31.x86_64 is already installed.
Package python3-importlib-metadata-0.18-1.fc31.noarch is already installed.
Package python3-packaging-19.0-1.fc30.noarch is already installed.
Package python3-pip-19.1.1-3.fc31.noarch is already installed.
Package python3-pytest-4.6.4-2.fc31.noarch is already installed.
Package python3-pytoml-0.1.18-3.fc30.noarch is already installed.
Package python3-setuptools-41.0.1-3.fc31.noarch is already installed.
Package python3-setuptools-41.0.1-3.fc31.noarch is already installed.
Package python3-setuptools_scm-3.3.3-1.fc31.noarch is already installed.
Package python3-tox-current-env-0.0.1-2.fc31.noarch is already installed.
Package python3-wheel-1:0.33.1-2.fc31.noarch is already installed.
Dependencies resolved.
Nothing to do.
Complete!
Building target platforms: x86_64
Building for target x86_64
Executing(%generate_buildrequires): /bin/sh -e /var/tmp/rpm-tmp.F2G7Ww
+ umask 022
+ cd /builddir/build/BUILD
+ cd pluggy-0.12.0
+ echo python3-devel
+ echo 'python3dist(packaging)'
+ echo 'python3dist(pip) >= 19'
+ echo 'python3dist(pytoml)'
+ rm -rfv pluggy.dist-info/
+ '[' -f /usr/bin/python3 ']'
+ /usr/bin/python3 -I /usr/lib/rpm/redhat/pyproject_buildrequires.py -t py37-pytestrelease
Handling setuptools from build-system.requires
Requirement satisfied: setuptools
   (installed: setuptools 41.0.1)
Handling setuptools-scm from build-system.requires
Requirement satisfied: setuptools-scm
   (installed: setuptools-scm 3.3.3)
Handling wheel from build-system.requires
Requirement satisfied: wheel
   (installed: wheel 0.33.1)
Handling setuptools >= 40.8 from default build backend
Requirement satisfied: setuptools >= 40.8
   (installed: setuptools 41.0.1)
Handling wheel from default build backend
Requirement satisfied: wheel
   (installed: wheel 0.33.1)
Handling wheel from get_requires_for_build_wheel
Requirement satisfied: wheel
   (installed: wheel 0.33.1)
Handling setuptools-scm from get_requires_for_build_wheel
Requirement satisfied: setuptools-scm
   (installed: setuptools-scm 3.3.3)
Handling tox-current-env from tox itself
Requirement satisfied: tox-current-env
   (installed: tox-current-env 0.0.1)
Handling pytest from tox --print-deps-only: py37-pytestrelease
Requirement satisfied: pytest
   (installed: pytest 4.6.4)
warning: no files found matching 'CHANGELOG'
warning: no previously-included files matching '*.pyc' found under directory '*'
warning: no previously-included files matching '*.pyo' found under directory '*'
HOOK STDOUT: running dist_info
HOOK STDOUT: creating pluggy.egg-info
HOOK STDOUT: writing pluggy.egg-info/PKG-INFO
HOOK STDOUT: writing dependency_links to pluggy.egg-info/dependency_links.txt
HOOK STDOUT: writing requirements to pluggy.egg-info/requires.txt
HOOK STDOUT: writing top-level names to pluggy.egg-info/top_level.txt
HOOK STDOUT: writing manifest file 'pluggy.egg-info/SOURCES.txt'
HOOK STDOUT: reading manifest file 'pluggy.egg-info/SOURCES.txt'
HOOK STDOUT: reading manifest template 'MANIFEST.in'
HOOK STDOUT: writing manifest file 'pluggy.egg-info/SOURCES.txt'
HOOK STDOUT: creating '/builddir/build/BUILD/pluggy-0.12.0/pluggy.dist-info'
Handling importlib-metadata (>=0.12) from wheel metadata: Requires-Dist
Requirement satisfied: importlib-metadata (>=0.12)
   (installed: importlib-metadata 0.18)
Handling pre-commit ; extra == 'dev' from wheel metadata: Requires-Dist
Ignoring alien requirement: pre-commit ; extra == 'dev'
Handling tox ; extra == 'dev' from wheel metadata: Requires-Dist
Ignoring alien requirement: tox ; extra == 'dev'
+ RPM_EC=0
++ jobs -p
+ exit 0
error: line 50: Dependency tokens must begin with alpha-numeric, '_' or '/': /usr/lib/python3.7/site-packages/pluggy-0.12.0.dist-info/

error: line 50: Dependency tokens must begin with alpha-numeric, '_' or '/': /usr/lib/python3.7/site-packages/pluggy-0.12.0.dist-info/

error: line 50: Dependency tokens must begin with alpha-numeric, '_' or '/': /usr/lib/python3.7/site-packages/pluggy-0.12.0.dist-info/

error: line 50: Dependency tokens must begin with alpha-numeric, '_' or '/': /usr/lib/python3.7/site-packages/pluggy-0.12.0.dist-info/

python3-devel
python3dist(packaging)
python3dist(pip) >= 19
python3dist(pytoml)
removed 'pluggy.dist-info/METADATA'
removed 'pluggy.dist-info/top_level.txt'
removed 'pluggy.dist-info/LICENSE'
removed directory 'pluggy.dist-info/'
python3dist(setuptools)
python3dist(setuptools-scm)
python3dist(wheel)
python3dist(setuptools) >= 40.8
python3dist(wheel)
python3dist(wheel)
python3dist(setuptools-scm)
python3dist(tox-current-env)
python3dist(pytest)
python3dist(importlib-metadata) >= 0.12
Executing(%build)...

The error is:

error: line 50: Dependency tokens must begin with alpha-numeric, '_' or '/': /usr/lib/python3.7/site-packages/pluggy-0.12.0.dist-info/

The line si the expanded last line fo the specfile. If I edit it, it changes.
The script does not print that line to standard output.

I believe this happened even before this PR, with %pyproject_buildrequires -r.

I have no idea how to debug where this error comes from.

cc @ignatenkobrain @ffesti @msuchy

Apperently the TODO from this PRs description is impossible.

Hence I propose we do do either of the following:

Option 1: -t takes no argument. To change the toxenv, redefine %toxenv

Option 2: -t takes no argument. To change the toxenv, use -e. -e implies -t.

(Optionally, this can be combined of course.)

@pviktori WDYT?

I would prefer option 1.I have no idea how to debug where this error comes from.

I have no idea how to debug where this error comes from.

Could you please open an issue on upstream RPM tracker with spec, macro and some steps to reproduce so that I could try it out?

Typo: quite→quiet
Could we use --recreate rather than -r (recreate) for readability?

3 new commits added

  • Add %tox macro to invoke tests
  • Define and save %toxenv for further use
  • Allow to fetch test dependencies from tox
4 years ago

"--toxenv implies --runtime" should be handled before this check

Typo: depndencies→dependencies

What I meant is that with this patch, I get:

$ python3 pyproject_buildrequires.py --toxenv py38-release --extras testing
-x (--extras) are only useful with -r (--runtime)

But --toxenv should imply --runtime. Lines 46-47 shouldn't be removed.

I understood that. I'm waiting for fixes in tox-current-env before Ill address the review comments here.

Retracting my previous comment. The PR looks good!

Metadata Update from @churchyard:
- Request assigned

4 years ago

3 new commits added

  • Add %tox macro to invoke tests
  • Define and save %toxenv for further use
  • Allow to fetch test dependencies from tox
4 years ago

4 new commits added

  • Use tox with --print-deps-to-file instead of parsing stdout
  • Add %tox macro to invoke tests
  • Define and save %toxenv for further use
  • Allow to fetch test dependencies from tox
4 years ago

1 new commit added

  • --toxenv implies --runtime
4 years ago

1 new commit added

  • -t means "use tox", -e means "use this toxenv", -e implies -t
4 years ago

[citest] (error composing cloud image, no idea)

[citest] (Error: Failed to download metadata for repo 'koji-f32-build')

Metadata Update from @churchyard:
- Request assignee reset

4 years ago

I have question about purpose of setting $RPM_TOXENV?
rpm --eval "%pyproject_buildrequires -e %{toxenv}-unit, %{toxenv}-int"
expands to:

echo 'python3-devel'
echo 'python3dist(packaging)'
echo 'python3dist(pip) >= 19'
echo 'python3dist(pytoml)'
# setuptools assumes no pre-existing dist-info
rm -rfv *.dist-info/
if [ -f /usr/bin/python3 ]; then
  RPM_TOXENV=py37-unit, /usr/bin/python3 -I /usr/lib/rpm/redhat/pyproject_buildrequires.py -e py37-unit, py37-int
fi


So $RPM_TOXENV ignores the second argument. In pyproject_buildrequires.py command arguments have priority if there are None after that script work with $RPM-TOXENV. But that will never happen because rpm want make option empty:

rpm --eval "%pyproject_buildrequires -e"
pyproject_buildrequires: option requires an argument -- 'e'
error: Unknown option e in pyproject_buildrequires(rxte:)

RPM_TOXENV should not contain spaces. It works like the -e tox argument.

%pyproject_buildrequires -e

is not valid either.

Thanks, so the $RPM_TOXENV is for debugging?

Nope, for passing the default in.

Note that tox -e apparently supports spaces, so that needs fixing. Good catch.

1 new commit added

  • Support spaces in %toxenv
4 years ago

Merged from CLI (due to Pagure issue); building at https://koji.fedoraproject.org/koji/taskinfo?taskID=37203674
(Failed because the python3.8 tag is half-merged. Will try building again.)

Pull-Request has been closed by pviktori

4 years ago