Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test failures with Python 3.12 #183

Closed
mgorny opened this issue Jul 23, 2023 · 3 comments
Closed

Test failures with Python 3.12 #183

mgorny opened this issue Jul 23, 2023 · 3 comments

Comments

@mgorny
Copy link

mgorny commented Jul 23, 2023

When running the test suite on Python 3.12.0b4, I'm getting the following test failures:

$ python -m pytest
========================================================= test session starts =========================================================
platform linux -- Python 3.12.0b4, pytest-7.4.0, pluggy-1.2.0
django: settings: testfixtures.tests.test_django.settings (from ini)
rootdir: /tmp/testfixtures
configfile: pytest.ini
plugins: cov-4.1.0, django-4.5.2
collected 1385 items                                                                                                                  

testfixtures/tests/test_django/test_compare.py .                                                                                [  0%]
docs/comparing.txt ..........................................................................F.F................                [  6%]
docs/components.txt ..............                                                                                              [  7%]
docs/datetime.txt ............................................................                                                  [ 12%]
docs/django.txt ..........                                                                                                      [ 12%]
docs/exceptions.txt ................                                                                                            [ 14%]
docs/files.txt ...........................................................................................                      [ 20%]
docs/installation.txt ..                                                                                                        [ 20%]
docs/logging.txt .......................................................                                                        [ 24%]
docs/mocking.txt ...............................................................................................                [ 31%]
docs/streams.txt ........                                                                                                       [ 32%]
docs/utilities.txt ..............                                                                                               [ 33%]
docs/warnings.txt ..................                                                                                            [ 34%]
testfixtures/tests/configparser-read.txt .....                                                                                  [ 34%]
testfixtures/tests/configparser-write.txt ....                                                                                  [ 35%]
testfixtures/tests/directory-contents.txt ....                                                                                  [ 35%]
testfixtures/tests/test_compare.py ............................................................................................ [ 42%]
...................................................................................................                             [ 49%]
testfixtures/tests/test_comparison.py ...............................................................                           [ 53%]
testfixtures/tests/test_components.py .                                                                                         [ 53%]
testfixtures/tests/test_date.py ..............................                                                                  [ 55%]
testfixtures/tests/test_datetime.py .................................................                                           [ 59%]
testfixtures/tests/test_diff.py ..                                                                                              [ 59%]
testfixtures/tests/test_generator.py ..                                                                                         [ 59%]
testfixtures/tests/test_log_capture.py ..................                                                                       [ 61%]
testfixtures/tests/test_logcapture.py ......................................                                                    [ 63%]
testfixtures/tests/test_mappingcomparison.py .............................                                                      [ 65%]
testfixtures/tests/test_mock.py .............                                                                                   [ 66%]
testfixtures/tests/test_outputcapture.py ...........                                                                            [ 67%]
testfixtures/tests/test_popen.py ..................................................                                             [ 71%]
testfixtures/tests/test_popen_docs.py .............                                                                             [ 72%]
testfixtures/tests/test_rangecomparison.py .........................................                                            [ 75%]
testfixtures/tests/test_replace.py .........................................................................                    [ 80%]
testfixtures/tests/test_replacer.py .........                                                                                   [ 81%]
testfixtures/tests/test_roundcomparison.py ......................................                                               [ 83%]
testfixtures/tests/test_sequencecomparison.py .....................................                                             [ 86%]
testfixtures/tests/test_should_raise.py ........................................                                                [ 89%]
testfixtures/tests/test_shouldwarn.py .............                                                                             [ 90%]
testfixtures/tests/test_stringcomparison.py ............                                                                        [ 91%]
testfixtures/tests/test_sybil.py ........                                                                                       [ 91%]
testfixtures/tests/test_tempdir.py ........                                                                                     [ 92%]
testfixtures/tests/test_tempdirectory.py ........FF..............................                                               [ 95%]
testfixtures/tests/test_time.py ..............................                                                                  [ 97%]
testfixtures/tests/test_twisted.py ............                                                                                 [ 98%]
testfixtures/tests/test_wrap.py ..............                                                                                  [ 99%]
testfixtures/tests/test_django/test_compare.py ........                                                                         [ 99%]
testfixtures/tests/test_django/test_shouldraise.py ..                                                                           [100%]

============================================================== FAILURES ===============================================================
___________________________________________________ comparing.txt line=790 column=1 ___________________________________________________

Example at /tmp/testfixtures/docs/comparing.txt, line 790, column 1 did not evaluate as expected:
Differences (ndiff with -expected +actual):
      Traceback (most recent call last):
    -  ...
    +   File "/usr/lib/python3.12/doctest.py", line 1357, in __run
    +     exec(compile(example.source, filename, "single",
    +   File "<doctest /tmp/testfixtures/docs/comparing.txt[0]>", line 1, in <module>
    +     compare(expected=M((('a', 1), ('c', 3), ('d', 2)), ordered=True),
    +   File "/tmp/testfixtures/testfixtures/comparison.py", line 758, in compare
    +     raise AssertionError(message)
    - AssertionError:...
    ?                ^^^
    + AssertionError: 
    ?                ^
      <MappingComparison(ordered=True, partial=False)(failed)>
      wrong key order:
      <BLANKLINE>
      same:
      ['a']
      <BLANKLINE>
      expected:
      ['c', 'd']
      <BLANKLINE>
      actual:
      ['d', 'c']
    - </MappingComparison(ordered=True, partial=False)> (expected) != OrderedDict([('a', 1), ('d', 2), ('c', 3)]) (actual)
    ?                                                                             ^^     -----     -----   ^   --
    + </MappingComparison(ordered=True, partial=False)> (expected) != OrderedDict({'a': 1, 'd': 2, 'c': 3}) (actual)
    ?                                                                             ^   +++     +++     ^  +

docs/comparing.txt:790: SybilFailure
___________________________________________________ comparing.txt line=829 column=1 ___________________________________________________

Example at /tmp/testfixtures/docs/comparing.txt, line 829, column 1 did not evaluate as expected:
Differences (ndiff with -expected +actual):
      Traceback (most recent call last):
    -  ...
    +   File "/usr/lib/python3.12/doctest.py", line 1357, in __run
    +     exec(compile(example.source, filename, "single",
    +   File "<doctest /tmp/testfixtures/docs/comparing.txt[0]>", line 1, in <module>
    +     compare(expected=M((('a', [1, 2]), ('d', [1, 3])), ordered=True, recursive=True),
    +   File "/tmp/testfixtures/testfixtures/comparison.py", line 758, in compare
    +     raise AssertionError(message)
    - AssertionError:...
    ?                ^^^
    + AssertionError: 
    ?                ^
      <MappingComparison(ordered=True, partial=False)(failed)>
      same:
      ['a']
      <BLANKLINE>
      values differ:
      'd': [1, 3] (expected) != [1, 4] (actual)
      <BLANKLINE>
      While comparing ['d']: sequence not as expected:
      <BLANKLINE>
      same:
      [1]
      <BLANKLINE>
      expected:
      [3]
      <BLANKLINE>
      actual:
      [4]
    - </MappingComparison(ordered=True, partial=False)> (expected) != OrderedDict([('a', [1, 2]), ('d', [1, 4])]) (actual)
    ?                                                                             ^^   ^       -  -   ^        --
    + </MappingComparison(ordered=True, partial=False)> (expected) != OrderedDict({'a': [1, 2], 'd': [1, 4]}) (actual)
    ?                                                                             ^   ^            ^       +

docs/comparing.txt:829: SybilFailure
__________________________________________ TempDirectoryTests.test_as_path_relative_sequence __________________________________________

self = <testfixtures.tests.test_tempdirectory.TempDirectoryTests testMethod=test_as_path_relative_sequence>

    def test_as_path_relative_sequence(self):
        with TempDirectory(encoding='ascii') as d:
>           compare(d.as_path(('foo', 'bar')), expected=Path(d.path) / 'foo' / 'bar', strict=True)
E           AssertionError: PosixPath not as expected:
E           
E           attributes differ:
E           '_raw_paths': ['/tmp/tmpof4njjhb', 'foo', 'bar'] (expected) != ['/tmp/tmpof4njjhb/foo/bar'] (actual)
E           
E           While comparing ._raw_paths: sequence not as expected:
E           
E           same:
E           []
E           
E           expected:
E           ['/tmp/tmpof4njjhb', 'foo', 'bar']
E           
E           actual:
E           ['/tmp/tmpof4njjhb/foo/bar']
E           
E           While comparing ._raw_paths[0]: 
E           '/tmp/tmpof4njjhb' (expected)
E           !=
E           '/tmp/tmpof4njjhb/foo/bar' (actual)

testfixtures/tests/test_tempdirectory.py:313: AssertionError
___________________________________________ TempDirectoryTests.test_as_path_relative_string ___________________________________________

self = <testfixtures.tests.test_tempdirectory.TempDirectoryTests testMethod=test_as_path_relative_string>

    def test_as_path_relative_string(self):
        with TempDirectory(encoding='ascii') as d:
>           compare(d.as_path('foo/bar'), expected=Path(d.path) / 'foo' / 'bar', strict=True)
E           AssertionError: PosixPath not as expected:
E           
E           attributes differ:
E           '_raw_paths': ['/tmp/tmpft4_d1rd', 'foo', 'bar'] (expected) != ['/tmp/tmpft4_d1rd/foo/bar'] (actual)
E           
E           While comparing ._raw_paths: sequence not as expected:
E           
E           same:
E           []
E           
E           expected:
E           ['/tmp/tmpft4_d1rd', 'foo', 'bar']
E           
E           actual:
E           ['/tmp/tmpft4_d1rd/foo/bar']
E           
E           While comparing ._raw_paths[0]: 
E           '/tmp/tmpft4_d1rd' (expected)
E           !=
E           '/tmp/tmpft4_d1rd/foo/bar' (actual)

testfixtures/tests/test_tempdirectory.py:309: AssertionError
========================================================== warnings summary ===========================================================
<unknown>:710
  <unknown>:710: SyntaxWarning: invalid escape sequence '\('

<unknown>:712
  <unknown>:712: SyntaxWarning: invalid escape sequence '\('

<unknown>:748
  <unknown>:748: SyntaxWarning: invalid escape sequence '\('

<unknown>:750
  <unknown>:750: SyntaxWarning: invalid escape sequence '\('

<unknown>:10
  <unknown>:10: SyntaxWarning: invalid escape sequence '\d'

<unknown>:13
  <unknown>:13: SyntaxWarning: invalid escape sequence '\d'

<unknown>:16
  <unknown>:16: SyntaxWarning: invalid escape sequence '\d'

<unknown>:19
  <unknown>:19: SyntaxWarning: invalid escape sequence '\d'

<unknown>:25
  <unknown>:25: SyntaxWarning: invalid escape sequence '\d'

<unknown>:29
  <unknown>:29: SyntaxWarning: invalid escape sequence '\d'

<unknown>:33
  <unknown>:33: SyntaxWarning: invalid escape sequence '\d'

<unknown>:37
  <unknown>:37: SyntaxWarning: invalid escape sequence '\d'

<unknown>:90
  <unknown>:90: SyntaxWarning: invalid escape sequence '\d'

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
======================================================= short test summary info =======================================================
FAILED docs/comparing.txt::line:790,column:1
FAILED docs/comparing.txt::line:829,column:1
FAILED testfixtures/tests/test_tempdirectory.py::TempDirectoryTests::test_as_path_relative_sequence - AssertionError: PosixPath not as expected:
FAILED testfixtures/tests/test_tempdirectory.py::TempDirectoryTests::test_as_path_relative_string - AssertionError: PosixPath not as expected:
============================================ 4 failed, 1381 passed, 13 warnings in 13.01s =============================================

The first two seem to be a difference in OrderedDict repr(), so not very bad. However, the next two I'm not sure if they're not actual bugs in path splitting somewhere.

@cjw296
Copy link
Member

cjw296 commented Jul 24, 2023

Thanks for the headsup, but I'm afraid I don't have bandwidth to support beta releases of Python.
When CircleCI has a 3.12 image, I'll get the above fixed.

@mgorny
Copy link
Author

mgorny commented Jul 24, 2023

Just for the record, it's hardly a beta at this point — RC1 is planned next week. Binding the development of your package to a proprietary CI platform with apparently poor Python support doesn't sound like a very good idea either.

@cjw296
Copy link
Member

cjw296 commented Jul 24, 2023

Please don't tell me how to run my project.

@cjw296 cjw296 closed this as completed Jul 24, 2023
@simplistix simplistix deleted a comment from mgorny Jul 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants