mbarkhau / bumpver

BumpVer: Automatic Versioning
https://github.com/mbarkhau/bumpver
MIT License
199 stars 36 forks source link

Running `make citest` fails at `test_compat` with `ModuleNotFoundError` #211

Open malnvenshorn opened 1 year ago

malnvenshorn commented 1 year ago

Running make citest fails at the test_compat stage with ModuleNotFoundError: No module named 'bumpver'.

# Next we install the package and run the test suite against it.
#       IFS=' ' read -r -a env_py_paths <<< "/opt/conda/envs/bumpver_py39/bin/python /opt/conda/envs/bumpver_pypy35/bin/pypy3 /opt/conda/envs/bumpver_py27/bin/python"; \
#       for i in ${!env_py_paths[@]}; do \
#               env_py=${env_py_paths[i]}; \
#               ${env_py} -m pip install --upgrade .; \
#               PYTHONPATH="" ENV=${ENV-dev} ${env_py} -m pytest test/; \
#       done;
rm -rf compat_test/fixtures;
mkdir -p compat_test/fixtures;
cp -R test/fixtures compat_test/
# install the package and run the test suite against it.
rm -rf build/test_wheel;
mkdir -p build/test_wheel;
/opt/conda/envs/bumpver_py39/bin/python setup.py bdist_wheel --dist-dir build/test_wheel;
running bdist_wheel
running build
running build_py
copying build/lib3to6_out/src/bumpver/__init__.py -> build/lib/bumpver
copying build/lib3to6_out/src/bumpver/v1version.py -> build/lib/bumpver
copying build/lib3to6_out/src/bumpver/parse.py -> build/lib/bumpver
copying build/lib3to6_out/src/bumpver/v1patterns.py -> build/lib/bumpver
copying build/lib3to6_out/src/bumpver/v2rewrite.py -> build/lib/bumpver
copying build/lib3to6_out/src/bumpver/pysix.py -> build/lib/bumpver
copying build/lib3to6_out/src/bumpver/version.py -> build/lib/bumpver
copying build/lib3to6_out/src/bumpver/v2patterns.py -> build/lib/bumpver
copying build/lib3to6_out/src/bumpver/rewrite.py -> build/lib/bumpver
copying build/lib3to6_out/src/bumpver/v2version.py -> build/lib/bumpver
copying build/lib3to6_out/src/bumpver/cli.py -> build/lib/bumpver
copying build/lib3to6_out/src/bumpver/v1rewrite.py -> build/lib/bumpver
copying build/lib3to6_out/src/bumpver/vcs.py -> build/lib/bumpver
copying build/lib3to6_out/src/bumpver/__main__.py -> build/lib/bumpver
copying build/lib3to6_out/src/bumpver/utils.py -> build/lib/bumpver
copying build/lib3to6_out/src/bumpver/regexfmt.py -> build/lib/bumpver
copying build/lib3to6_out/src/bumpver/config.py -> build/lib/bumpver
copying build/lib3to6_out/src/bumpver/patterns.py -> build/lib/bumpver
/opt/conda/envs/bumpver_py39/lib/python3.9/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
  warnings.warn(
installing to build/bdist.linux-x86_64/wheel
running install
running install_lib
creating build/bdist.linux-x86_64/wheel
creating build/bdist.linux-x86_64/wheel/bumpver
copying build/lib/bumpver/__init__.py -> build/bdist.linux-x86_64/wheel/bumpver
copying build/lib/bumpver/v1version.py -> build/bdist.linux-x86_64/wheel/bumpver
copying build/lib/bumpver/parse.py -> build/bdist.linux-x86_64/wheel/bumpver
copying build/lib/bumpver/v1patterns.py -> build/bdist.linux-x86_64/wheel/bumpver
copying build/lib/bumpver/v2rewrite.py -> build/bdist.linux-x86_64/wheel/bumpver
copying build/lib/bumpver/pysix.py -> build/bdist.linux-x86_64/wheel/bumpver
copying build/lib/bumpver/version.py -> build/bdist.linux-x86_64/wheel/bumpver
copying build/lib/bumpver/v2patterns.py -> build/bdist.linux-x86_64/wheel/bumpver
copying build/lib/bumpver/rewrite.py -> build/bdist.linux-x86_64/wheel/bumpver
copying build/lib/bumpver/v2version.py -> build/bdist.linux-x86_64/wheel/bumpver
copying build/lib/bumpver/cli.py -> build/bdist.linux-x86_64/wheel/bumpver
copying build/lib/bumpver/v1rewrite.py -> build/bdist.linux-x86_64/wheel/bumpver
copying build/lib/bumpver/vcs.py -> build/bdist.linux-x86_64/wheel/bumpver
copying build/lib/bumpver/__main__.py -> build/bdist.linux-x86_64/wheel/bumpver
copying build/lib/bumpver/utils.py -> build/bdist.linux-x86_64/wheel/bumpver
copying build/lib/bumpver/regexfmt.py -> build/bdist.linux-x86_64/wheel/bumpver
copying build/lib/bumpver/config.py -> build/bdist.linux-x86_64/wheel/bumpver
copying build/lib/bumpver/patterns.py -> build/bdist.linux-x86_64/wheel/bumpver
running install_egg_info
running egg_info
writing build/lib3to6_out/src/bumpver.egg-info/PKG-INFO
writing dependency_links to build/lib3to6_out/src/bumpver.egg-info/dependency_links.txt
writing entry points to build/lib3to6_out/src/bumpver.egg-info/entry_points.txt
writing requirements to build/lib3to6_out/src/bumpver.egg-info/requires.txt
writing top-level names to build/lib3to6_out/src/bumpver.egg-info/top_level.txt
writing manifest file 'build/lib3to6_out/src/bumpver.egg-info/SOURCES.txt'
reading manifest file 'build/lib3to6_out/src/bumpver.egg-info/SOURCES.txt'
adding license file 'LICENSE'
writing manifest file 'build/lib3to6_out/src/bumpver.egg-info/SOURCES.txt'
Copying build/lib3to6_out/src/bumpver.egg-info to build/bdist.linux-x86_64/wheel/bumpver-2023.1124-py3.9.egg-info
running install_scripts
creating build/bdist.linux-x86_64/wheel/bumpver-2023.1124.dist-info/WHEEL
creating 'build/test_wheel/bumpver-2023.1124-py2.py3-none-any.whl' and adding 'build/bdist.linux-x86_64/wheel' to it
adding 'bumpver/__init__.py'
adding 'bumpver/__main__.py'
adding 'bumpver/cli.py'
adding 'bumpver/config.py'
adding 'bumpver/parse.py'
adding 'bumpver/patterns.py'
adding 'bumpver/pysix.py'
adding 'bumpver/regexfmt.py'
adding 'bumpver/rewrite.py'
adding 'bumpver/utils.py'
adding 'bumpver/v1patterns.py'
adding 'bumpver/v1rewrite.py'
adding 'bumpver/v1version.py'
adding 'bumpver/v2patterns.py'
adding 'bumpver/v2rewrite.py'
adding 'bumpver/v2version.py'
adding 'bumpver/vcs.py'
adding 'bumpver/version.py'
adding 'bumpver-2023.1124.dist-info/LICENSE'
adding 'bumpver-2023.1124.dist-info/METADATA'
adding 'bumpver-2023.1124.dist-info/WHEEL'
adding 'bumpver-2023.1124.dist-info/entry_points.txt'
adding 'bumpver-2023.1124.dist-info/top_level.txt'
adding 'bumpver-2023.1124.dist-info/zip-safe'
adding 'bumpver-2023.1124.dist-info/RECORD'
removing build/bdist.linux-x86_64/wheel
IFS=' ' read -r -a env_pys <<< "/opt/conda/envs/bumpver_py39/bin/python /opt/conda/envs/bumpver_pypy35/bin/pypy3 /opt/conda/envs/bumpver_py27/bin/python"; \
for i in ${!env_pys[@]}; do \
        env_py=${env_pys[i]}; \
        ${env_py} -m pip install --upgrade build/test_wheel/*.whl; \
        ENABLE_BACKTRACE=0 PYTHONPATH="" ENV=${ENV-dev} \
                ${env_py} -m pytest \
                -k "${PYTEST_FILTER-${FLTR}}" \
                --verbose compat_test/; \
done;
Processing /build/test_wheel/bumpver-2023.1124-py2.py3-none-any.whl
Requirement already satisfied: looseversion in /opt/conda/envs/bumpver_py39/lib/python3.9/site-packages (from bumpver==2023.1124) (1.3.0)
Requirement already satisfied: click in /opt/conda/envs/bumpver_py39/lib/python3.9/site-packages (from bumpver==2023.1124) (8.0.3)
Requirement already satisfied: pathlib2 in /opt/conda/envs/bumpver_py39/lib/python3.9/site-packages (from bumpver==2023.1124) (2.3.6)
Requirement already satisfied: lexid in /opt/conda/envs/bumpver_py39/lib/python3.9/site-packages (from bumpver==2023.1124) (2021.1006)
Requirement already satisfied: colorama>=0.4 in /opt/conda/envs/bumpver_py39/lib/python3.9/site-packages (from bumpver==2023.1124) (0.4.4)
Requirement already satisfied: toml in /opt/conda/envs/bumpver_py39/lib/python3.9/site-packages (from bumpver==2023.1124) (0.10.2)
Requirement already satisfied: six in /opt/conda/envs/bumpver_py39/lib/python3.9/site-packages (from pathlib2->bumpver==2023.1124) (1.16.0)
bumpver is already installed with the same version as the provided wheel. Use --force-reinstall to force an installation of the wheel.
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
============================================ test session starts =============================================
platform linux -- Python 3.9.7, pytest-6.2.5, py-1.11.0, pluggy-1.0.0 -- /opt/conda/envs/bumpver_py39/bin/python
cachedir: .pytest_cache
metadata: {'Python': '3.9.7', 'Platform': 'Linux-6.3.9-arch1-1-x86_64-with-glibc2.24', 'Packages': {'pytest': '6.2.5', 'py': '1.11.0', 'pluggy': '1.0.0'}, 'Plugins': {'cov': '3.0.0', 'html': '1.22.1', 'metadata': '1.11.0'}}
rootdir: /, configfile: setup.cfg
plugins: cov-3.0.0, html-1.22.1, metadata-1.11.0
collected 0 items / 12 errors                                                                                

=================================================== ERRORS ===================================================
__________________________________ ERROR collecting compat_test/test_cli.py __________________________________
compat_test/test_cli.py:17: in <module>
    from bumpver import cli
E   ModuleNotFoundError: No module named 'bumpver'
__________________________________ ERROR collecting compat_test/test_cli.py __________________________________
ImportError while importing test module '/compat_test/test_cli.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
opt/conda/envs/bumpver_py39/lib/python3.9/importlib/__init__.py:127: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
compat_test/test_cli.py:17: in <module>
    from bumpver import cli
E   ModuleNotFoundError: No module named 'bumpver'

...
malnvenshorn commented 1 year ago

It's strange make citest fails, but using it with docker compose works:

docker-compose.yml

version: '3.9'

services:
  bumpver:
    build:
      context: .
      dockerfile: docker_bumpver.Dockerfile
      args:
        UID: 1000
        GID: 1000
    command: make fmt lint mypy test test_compat
    user: test
    tty: true
    working_dir: /test/app
    volumes:
      - ./:/test/app

docker_bumpver.Dockerfile

FROM registry.gitlab.com/mbarkhau/pycalver/base

ARG UID
ARG GID

RUN groupadd test -g ${GID}
RUN useradd test -u ${UID} -g ${GID} -m -s /bin/bash