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

TypeError in tests for read_newlines and show-newlines (no newline argument) #10

Closed
kloczek opened this issue Aug 13, 2022 · 3 comments
Closed

Comments

@kloczek
Copy link

kloczek commented Aug 13, 2022

+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-jaraco-text-3.9.0-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-jaraco-text-3.9.0-2.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra
=========================================================================== test session starts ============================================================================
platform linux -- Python 3.8.13, pytest-7.1.2, pluggy-1.0.0
rootdir: /home/tkloczko/rpmbuild/BUILD/jaraco.text-3.9.0, configfile: pytest.ini
plugins: cov-3.0.0
collected 26 items

jaraco/text/__init__.py ...............F.......                                                                                                                      [ 88%]
jaraco/text/layouts.py ..                                                                                                                                            [ 96%]
jaraco/text/show-newlines.py F                                                                                                                                       [100%]

================================================================================= FAILURES =================================================================================
_______________________________________________________________________ [doctest] text.read_newlines _______________________________________________________________________
604
605     >>> tmp_path = getfixture('tmp_path')
606     >>> filename = tmp_path / 'out.txt'
607     >>> _ = filename.write_text('foo\n', newline='')
UNEXPECTED EXCEPTION: TypeError("write_text() got an unexpected keyword argument 'newline'")
Traceback (most recent call last):
  File "/usr/lib64/python3.8/doctest.py", line 1336, in __run
    exec(compile(example.source, filename, "single",
  File "<doctest text.read_newlines[2]>", line 1, in <module>
TypeError: write_text() got an unexpected keyword argument 'newline'
/home/tkloczko/rpmbuild/BUILD/jaraco.text-3.9.0/jaraco/text/__init__.py:607: UnexpectedException
_______________________________________________________________ [doctest] text.show-newlines.report_newlines _______________________________________________________________
010
011     Report the newlines in the indicated file.
012
013     >>> tmp_path = getfixture('tmp_path')
014     >>> filename = tmp_path / 'out.txt'
015     >>> _ = filename.write_text('foo\nbar\n', newline='')
UNEXPECTED EXCEPTION: TypeError("write_text() got an unexpected keyword argument 'newline'")
Traceback (most recent call last):
  File "/usr/lib64/python3.8/doctest.py", line 1336, in __run
    exec(compile(example.source, filename, "single",
  File "<doctest text.show-newlines.report_newlines[2]>", line 1, in <module>
TypeError: write_text() got an unexpected keyword argument 'newline'
/home/tkloczko/rpmbuild/BUILD/jaraco.text-3.9.0/jaraco/text/show-newlines.py:15: UnexpectedException
========================================================================= short test summary info ==========================================================================
FAILED jaraco/text/__init__.py::text.read_newlines
FAILED jaraco/text/show-newlines.py::text.show-newlines.report_newlines
======================================================================= 2 failed, 24 passed in 0.11s =======================================================================
@bnavigator
Copy link

bnavigator commented Aug 18, 2022

The newline parameter was only added in Python 3.10

https://docs.python.org/3/library/pathlib.html#pathlib.Path.write_text

@jaraco your CI jobs labeled "3.7" actually run pytest with Python 3.10:
https://github.com/jaraco/jaraco.text/runs/7820967297?check_suite_focus=true#step:5:14

@jaraco
Copy link
Owner

jaraco commented Aug 18, 2022

CI jobs labeled "3.7" actually run pytest with Python 3.10

I don't think it's my fault:
image

@jaraco
Copy link
Owner

jaraco commented Aug 18, 2022

It's a known bug apparently fixed with v4.

@jaraco jaraco closed this as completed in d6ce82d Aug 18, 2022
@jaraco jaraco changed the title 3.9.0: pytest is failing TypeError in tests for read_newlines and show-newlines (no newline argument) Aug 18, 2022
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

3 participants