Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

2.0.1: pytest is failing #173

Copy link
Copy link
@kloczek

Description

@kloczek
Issue body actions

I'm trying to package your module as an rpm package. So I'm using the typical build, install and test cycle used on building packages from non-root account.

  • "setup.py build"
  • "setup.py install --root </install/prefix>"
  • "pytest with PYTHONPATH pointing to sitearch and sitelib inside </install/prefix>

May I ask for help because few units are failing:

Details
+ /usr/bin/pytest -ra
=========================================================================== test session starts ============================================================================
platform linux -- Python 3.8.12, pytest-6.2.5, py-1.10.0, pluggy-0.13.1
benchmark: 3.4.1 (defaults: timer=time.perf_counter disable_gc=False min_rounds=5 min_time=0.000005 max_time=1.0 calibration_precision=10 warmup=False warmup_iterations=100000)
rootdir: /home/tkloczko/rpmbuild/BUILD/formencode-2.0.1, configfile: pytest.ini
plugins: shutil-1.7.0, virtualenv-1.7.0, mock-3.6.1, cov-2.12.1, anyio-3.3.4, forked-1.3.0, xdist-2.3.0, flaky-3.7.0, tornasync-0.6.0.post2, console-scripts-1.2.0, trio-0.7.0, timeout-2.0.1, asyncio-0.16.0, freezegun-0.4.2, flake8-1.0.7, pyfakefs-4.5.3, hypothesis-6.29.3, benchmark-3.4.1, profiling-1.7.0, datadir-1.3.1, regressions-2.2.0, randomly-3.8.0, rerunfailures-9.1.1, yagot-0.5.0, requests-mock-1.9.3, django-4.5.1
collected 268 items

formencode/tests/test_cc.py ..                                                                                                                                       [  0%]
formencode/tests/test_compound.py .................                                                                                                                  [  7%]
formencode/tests/test_context.py ...                                                                                                                                 [  8%]
formencode/tests/test_declarative.py ....                                                                                                                            [  9%]
formencode/tests/test_doctest_xml_compare.py .                                                                                                                       [ 10%]
formencode/tests/test_doctests.py ......F..                                                                                                                          [ 13%]
formencode/tests/test_email.py ....                                                                                                                                  [ 14%]
formencode/tests/test_htmlfill.py ..............................................                                                                                     [ 32%]
formencode/tests/test_htmlfill_control.py .......                                                                                                                    [ 34%]
formencode/tests/test_htmlgen.py .......                                                                                                                             [ 37%]
formencode/tests/test_htmlrename.py .                                                                                                                                [ 37%]
formencode/tests/test_i18n.py ........................                                                                                                               [ 46%]
formencode/tests/test_schema.py .......................                                                                                                              [ 55%]
formencode/tests/test_subclassing.py ...............                                                                                                                 [ 60%]
formencode/tests/test_subclassing_old.py ................                                                                                                            [ 66%]
formencode/tests/test_validators.py ..............................................................................                                                   [ 95%]
formencode/tests/test_variabledecode.py ...........                                                                                                                  [100%]

================================================================================= FAILURES =================================================================================
__________________________________________________________ test_doctests[_wrapper-formencode.national-False-True] __________________________________________________________

testfn = <function set_func_description.<locals>._wrapper at 0x7f1592e03790>
document = <module 'formencode.national' from '/home/tkloczko/rpmbuild/BUILD/formencode-2.0.1/formencode/national.py'>, verbose = False, raise_error = True

    @pytest.mark.parametrize("testfn,document,verbose,raise_error", list(collect_functions()))
    def test_doctests(testfn,document,verbose,raise_error):
        """Generate each doctest."""
>       testfn(document, verbose, raise_error)

formencode/tests/test_doctests.py:96:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
formencode/tests/test_doctests.py:73: in _wrapper
    fn(*a_test_args)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

document = <module 'formencode.national' from '/home/tkloczko/rpmbuild/BUILD/formencode-2.0.1/formencode/national.py'>, verbose = False, raise_error = True

    def doctest_module(document, verbose, raise_error):
        failure_count, test_count = doctest.testmod(document,
                optionflags=doctest.ELLIPSIS | doctest.IGNORE_EXCEPTION_DETAIL,
                verbose=verbose)
        if raise_error:
            assert test_count > 0
>           assert failure_count == 0
E           assert 11 == 0

formencode/tests/test_doctests.py:67: AssertionError
--------------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------------
**********************************************************************
File "/home/tkloczko/rpmbuild/BUILD/formencode-2.0.1/formencode/national.py", line 423, in formencode.national.CountryValidator
Failed example:
    CountryValidator.to_python('Germany')
Exception raised:
    Traceback (most recent call last):
      File "/usr/lib64/python3.8/doctest.py", line 1336, in __run
        exec(compile(example.source, filename, "single",
      File "<doctest formencode.national.CountryValidator[0]>", line 1, in <module>
        CountryValidator.to_python('Germany')
      File "/home/tkloczko/rpmbuild/BUILD/formencode-2.0.1/formencode/api.py", line 506, in to_python
        value = tp(value, state)
      File "/home/tkloczko/rpmbuild/BUILD/formencode-2.0.1/formencode/national.py", line 458, in _convert_to_python
        for k, v in get_countries():
    NameError: name 'get_countries' is not defined
**********************************************************************
File "/home/tkloczko/rpmbuild/BUILD/formencode-2.0.1/formencode/national.py", line 425, in formencode.national.CountryValidator
Failed example:
    CountryValidator.to_python('Finland')
Exception raised:
    Traceback (most recent call last):
      File "/usr/lib64/python3.8/doctest.py", line 1336, in __run
        exec(compile(example.source, filename, "single",
      File "<doctest formencode.national.CountryValidator[1]>", line 1, in <module>
        CountryValidator.to_python('Finland')
      File "/home/tkloczko/rpmbuild/BUILD/formencode-2.0.1/formencode/api.py", line 506, in to_python
        value = tp(value, state)
      File "/home/tkloczko/rpmbuild/BUILD/formencode-2.0.1/formencode/national.py", line 458, in _convert_to_python
        for k, v in get_countries():
    NameError: name 'get_countries' is not defined
**********************************************************************
File "/home/tkloczko/rpmbuild/BUILD/formencode-2.0.1/formencode/national.py", line 427, in formencode.national.CountryValidator
Failed example:
    CountryValidator.to_python('UNITED STATES')
Exception raised:
    Traceback (most recent call last):
      File "/usr/lib64/python3.8/doctest.py", line 1336, in __run
        exec(compile(example.source, filename, "single",
      File "<doctest formencode.national.CountryValidator[2]>", line 1, in <module>
        CountryValidator.to_python('UNITED STATES')
      File "/home/tkloczko/rpmbuild/BUILD/formencode-2.0.1/formencode/api.py", line 506, in to_python
        value = tp(value, state)
      File "/home/tkloczko/rpmbuild/BUILD/formencode-2.0.1/formencode/national.py", line 458, in _convert_to_python
        for k, v in get_countries():
    NameError: name 'get_countries' is not defined
**********************************************************************
File "/home/tkloczko/rpmbuild/BUILD/formencode-2.0.1/formencode/national.py", line 429, in formencode.national.CountryValidator
Failed example:
    CountryValidator.to_python('Krakovia')
Expected:
    Traceback (most recent call last):
        ...
    Invalid: That country is not listed in ISO 3166
Got:
    Traceback (most recent call last):
      File "/usr/lib64/python3.8/doctest.py", line 1336, in __run
        exec(compile(example.source, filename, "single",
      File "<doctest formencode.national.CountryValidator[3]>", line 1, in <module>
        CountryValidator.to_python('Krakovia')
      File "/home/tkloczko/rpmbuild/BUILD/formencode-2.0.1/formencode/api.py", line 506, in to_python
        value = tp(value, state)
      File "/home/tkloczko/rpmbuild/BUILD/formencode-2.0.1/formencode/national.py", line 458, in _convert_to_python
        for k, v in get_countries():
    NameError: name 'get_countries' is not defined
**********************************************************************
File "/home/tkloczko/rpmbuild/BUILD/formencode-2.0.1/formencode/national.py", line 433, in formencode.national.CountryValidator
Failed example:
    CountryValidator.from_python('DE')
Exception raised:
    Traceback (most recent call last):
      File "/usr/lib64/python3.8/doctest.py", line 1336, in __run
        exec(compile(example.source, filename, "single",
      File "<doctest formencode.national.CountryValidator[4]>", line 1, in <module>
        CountryValidator.from_python('DE')
      File "/home/tkloczko/rpmbuild/BUILD/formencode-2.0.1/formencode/api.py", line 540, in from_python
        value = fp(value, state)
      File "/home/tkloczko/rpmbuild/BUILD/formencode-2.0.1/formencode/national.py", line 465, in _convert_from_python
        return get_country(value.upper())
    NameError: name 'get_country' is not defined
**********************************************************************
File "/home/tkloczko/rpmbuild/BUILD/formencode-2.0.1/formencode/national.py", line 435, in formencode.national.CountryValidator
Failed example:
    CountryValidator.from_python('FI')
Exception raised:
    Traceback (most recent call last):
      File "/usr/lib64/python3.8/doctest.py", line 1336, in __run
        exec(compile(example.source, filename, "single",
      File "<doctest formencode.national.CountryValidator[5]>", line 1, in <module>
        CountryValidator.from_python('FI')
      File "/home/tkloczko/rpmbuild/BUILD/formencode-2.0.1/formencode/api.py", line 540, in from_python
        value = fp(value, state)
      File "/home/tkloczko/rpmbuild/BUILD/formencode-2.0.1/formencode/national.py", line 465, in _convert_from_python
        return get_country(value.upper())
    NameError: name 'get_country' is not defined
**********************************************************************
File "/home/tkloczko/rpmbuild/BUILD/formencode-2.0.1/formencode/national.py", line 825, in formencode.national.LanguageValidator
Failed example:
    l.to_python('German')
Exception raised:
    Traceback (most recent call last):
      File "/usr/lib64/python3.8/doctest.py", line 1336, in __run
        exec(compile(example.source, filename, "single",
      File "<doctest formencode.national.LanguageValidator[1]>", line 1, in <module>
        l.to_python('German')
      File "/home/tkloczko/rpmbuild/BUILD/formencode-2.0.1/formencode/api.py", line 506, in to_python
        value = tp(value, state)
      File "/home/tkloczko/rpmbuild/BUILD/formencode-2.0.1/formencode/national.py", line 858, in _convert_to_python
        for k, v in get_languages():
    NameError: name 'get_languages' is not defined
**********************************************************************
File "/home/tkloczko/rpmbuild/BUILD/formencode-2.0.1/formencode/national.py", line 827, in formencode.national.LanguageValidator
Failed example:
    l.to_python('Chinese')
Exception raised:
    Traceback (most recent call last):
      File "/usr/lib64/python3.8/doctest.py", line 1336, in __run
        exec(compile(example.source, filename, "single",
      File "<doctest formencode.national.LanguageValidator[2]>", line 1, in <module>
        l.to_python('Chinese')
      File "/home/tkloczko/rpmbuild/BUILD/formencode-2.0.1/formencode/api.py", line 506, in to_python
        value = tp(value, state)
      File "/home/tkloczko/rpmbuild/BUILD/formencode-2.0.1/formencode/national.py", line 858, in _convert_to_python
        for k, v in get_languages():
    NameError: name 'get_languages' is not defined
**********************************************************************
File "/home/tkloczko/rpmbuild/BUILD/formencode-2.0.1/formencode/national.py", line 829, in formencode.national.LanguageValidator
Failed example:
    l.to_python('Klingonian')
Expected:
    Traceback (most recent call last):
        ...
    Invalid: That language is not listed in ISO 639
Got:
    Traceback (most recent call last):
      File "/usr/lib64/python3.8/doctest.py", line 1336, in __run
        exec(compile(example.source, filename, "single",
      File "<doctest formencode.national.LanguageValidator[3]>", line 1, in <module>
        l.to_python('Klingonian')
      File "/home/tkloczko/rpmbuild/BUILD/formencode-2.0.1/formencode/api.py", line 506, in to_python
        value = tp(value, state)
      File "/home/tkloczko/rpmbuild/BUILD/formencode-2.0.1/formencode/national.py", line 858, in _convert_to_python
        for k, v in get_languages():
    NameError: name 'get_languages' is not defined
**********************************************************************
File "/home/tkloczko/rpmbuild/BUILD/formencode-2.0.1/formencode/national.py", line 833, in formencode.national.LanguageValidator
Failed example:
    l.from_python('de')
Exception raised:
    Traceback (most recent call last):
      File "/usr/lib64/python3.8/doctest.py", line 1336, in __run
        exec(compile(example.source, filename, "single",
      File "<doctest formencode.national.LanguageValidator[4]>", line 1, in <module>
        l.from_python('de')
      File "/home/tkloczko/rpmbuild/BUILD/formencode-2.0.1/formencode/api.py", line 540, in from_python
        value = fp(value, state)
      File "/home/tkloczko/rpmbuild/BUILD/formencode-2.0.1/formencode/national.py", line 865, in _convert_from_python
        return get_language(value.lower())
    NameError: name 'get_language' is not defined
**********************************************************************
File "/home/tkloczko/rpmbuild/BUILD/formencode-2.0.1/formencode/national.py", line 835, in formencode.national.LanguageValidator
Failed example:
    l.from_python('zh')
Exception raised:
    Traceback (most recent call last):
      File "/usr/lib64/python3.8/doctest.py", line 1336, in __run
        exec(compile(example.source, filename, "single",
      File "<doctest formencode.national.LanguageValidator[5]>", line 1, in <module>
        l.from_python('zh')
      File "/home/tkloczko/rpmbuild/BUILD/formencode-2.0.1/formencode/api.py", line 540, in from_python
        value = fp(value, state)
      File "/home/tkloczko/rpmbuild/BUILD/formencode-2.0.1/formencode/national.py", line 865, in _convert_from_python
        return get_language(value.lower())
    NameError: name 'get_language' is not defined
**********************************************************************
2 items had failures:
   6 of   6 in formencode.national.CountryValidator
   5 of   6 in formencode.national.LanguageValidator
***Test Failed*** 11 failures.
============================================================================= warnings summary =============================================================================
formencode/tests/test_doctests.py::test_doctests[_wrapper-formencode.national-False-True]
  /home/tkloczko/rpmbuild/BUILD/formencode-2.0.1/formencode/declarative.py:167: Warning: Please easy_install pycountry or validators handling country names and/or languages will not work.
    setattr(cls, name, cls(

formencode/tests/test_doctests.py::test_doctests[_wrapper-formencode.national-False-True]
  <doctest formencode.national.LanguageValidator[0]>:1: Warning: Please easy_install pycountry or validators handling country names and/or languages will not work.

formencode/tests/test_doctests.py::test_doctests[_wrapper-formencode.validators-False-True]
formencode/tests/test_doctests.py::test_doctests[_wrapper-formencode.validators-False-True]
formencode/tests/test_doctests.py::test_doctests[_wrapper-formencode.validators-False-True]
formencode/tests/test_doctests.py::test_doctests[_wrapper-formencode.validators-False-True]
formencode/tests/test_email.py::TestUnicodeEmailWithResolveDomain::test_unicode_ascii_subgroup
  /home/tkloczko/rpmbuild/BUILD/formencode-2.0.1/formencode/validators.py:1381: DeprecationWarning: please use dns.resolver.resolve() instead
    dns.resolver.query(domain, 'MX')

formencode/tests/test_doctests.py::test_doctests[_wrapper-formencode.validators-False-True]
  /home/tkloczko/rpmbuild/BUILD/formencode-2.0.1/formencode/validators.py:1384: DeprecationWarning: please use dns.resolver.resolve() instead
    dns.resolver.query(domain, 'A')

-- Docs: https://docs.pytest.org/en/stable/warnings.html
========================================================================= short test summary info ==========================================================================
FAILED formencode/tests/test_doctests.py::test_doctests[_wrapper-formencode.national-False-True] - assert 11 == 0
================================================================ 1 failed, 267 passed, 8 warnings in 2.56s =================================================================
Reactions are currently unavailable

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

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.