Skip to content

When running Approval tests, there is NameError: name 'version_number' is not defined #103

Closed

Description

@aaltat

When using Approval tests 3.1.1, I see error when running tests

"/opt/hostedtoolcache/Python/3.7.12/x64/lib/python3.7/site-packages/approvaltests/__init__.py", line 8, in <module>
    __version__ = version_number
NameError: name 'version_number' is not defined
Error: Process completed with exit code 1.

Error did not happen with version 3.1.0.

Full stack trace at https://github.com/MarketSquare/robotframework-browser/runs/4304274907?check_suite_focus=true

Activity

  1. aaltat commented on Nov 26, 2021

    @aaltat
    ContributorAuthor

    I can reproduce the problem with this

    Python 3.10.0 (v3.10.0:b494f5935c, Oct  4 2021, 14:59:19) [Clang 12.0.5 (clang-1205.0.22.11)] on darwin
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import approvaltests
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "/Users/user/workspace/tmp/.venv_test/lib/python3.10/site-packages/approvaltests/__init__.py", line 8, in <module>
        __version__ = version_number
    NameError: name 'version_number' is not defined
    >>> 
    
    

    I only have approval test installed in Python virtual enviroment and my pip list looks like:

    Package            Version
    ------------------ ---------
    approvaltests      3.1.1
    attrs              21.2.0
    beautifulsoup4     4.10.0
    bs4                0.0.1
    certifi            2021.10.8
    charset-normalizer 2.0.8
    empty-files        0.0.3
    idna               3.3
    iniconfig          1.1.1
    packaging          21.3
    pip                21.3.1
    pluggy             1.0.0
    py                 1.11.0
    pyparsing          3.0.6
    pyperclip          1.5.27
    pytest             6.2.5
    requests           2.26.0
    setuptools         57.4.0
    soupsieve          2.3.1
    toml               0.10.2
    urllib3            1.26.7
    
  2. aaltat commented on Nov 26, 2021

    @aaltat
    ContributorAuthor

    When I download version 3.1.1 ( https://pypi.org/project/approvaltests/3.1.1/#files ) from Pypi and look at the version.py I see

    version="v3.1.1"
    

    But init.py uses:

    __version__ = version_number
    

    I think the bug is in GitHub action. I think echo version should be echo version_number.

  3. aaltat commented on Dec 6, 2021

    @aaltat
    ContributorAuthor
  4. schmonz commented on Dec 15, 2021

    @schmonz
    Contributor

    +1: for the pkgsrc package, I get the same NameError as @aaltat when trying to run the pytest example from the README. And patching approvaltests/version.py to say version_number instead of version makes things work.

  5. claremacrae commented on Dec 15, 2021

    @claremacrae
    Contributor

    +1: for the pkgsrc package, I get the same NameError as @aaltat when trying to run the pytest example from the README. And patching approvaltests/version.py to say version_number instead of version makes things work.

    Best to ping Llewellyn directly, as AFAIK he doesn't see/receive GitHub notifications...

    There is a PR for this already, I see...

  6. aaltat commented on Dec 15, 2021

    @aaltat
    ContributorAuthor

    Would someone be able to ping him, I have no idea where to reach him?

  7. claremacrae commented on Dec 15, 2021

    @claremacrae
    Contributor

    I've just pinged Llewellyn :-)

    A small group works on it most Sundays, so it may get picked up then...

  8. schmonz commented on Dec 22, 2021

    @schmonz
    Contributor

    3.3.2 solves this for me. If @aaltat agrees, this can be closed.

  9. isidore commented on Feb 6, 2022

    @isidore
    Member

    Thanks, fixed in 3.3.2
    Sorry for the bug

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions