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

Unicode support #31

Merged
merged 1 commit into from
Jan 5, 2016
Merged

Unicode support #31

merged 1 commit into from
Jan 5, 2016

Conversation

sirex
Copy link
Contributor

@sirex sirex commented Jan 4, 2016

See #30

Run these tests: tox -e py26,py27,py34, don't have other snakes.

@The-Compiler
Copy link
Collaborator

You might want to use a backslash-escape (i.e. \uXXXX) instead of a literal to get things working with Python 3.2.

@abusalimov
Copy link
Collaborator

Thanks for the contribution! Can we avoid the 'six' dependency? I'm pretty sure, there should be the same compat type somewhere in py.builtin.

@The-Compiler
Copy link
Collaborator

six.text_type is py.builtin.text I think, and probably you can use py.builtin._totext instead of six.u.

@sirex
Copy link
Contributor Author

sirex commented Jan 4, 2016

py.builtin._totext did not worked out of the box: https://bitbucket.org/pytest-dev/py/issues/75/pybuiltin_totext-does-not-work-with-python

But after replacing _totext, removed six dependency.

I think, py should use six too, instead of reinventing the wheel.

@The-Compiler
Copy link
Collaborator

I bet py existed before six did (but I didn't check) 😉

The long-term plan for pytest is to move away from pylib, though.

obj = obj.decode(encoding)
else:
obj = obj.decode(encoding, errors)
return obj
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is only used in the test. Do we need it here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added it here to be able to access it from testdir.makepyfile. If there is a batter way how to make _totext visible from testdir.makepyfile, I can fix it.

@abusalimov
Copy link
Collaborator

@The-Compiler maybe we could permit usage of six for testing, WDYT? Apparently, _totext is broken, and we need u(...) in tests...

@The-Compiler
Copy link
Collaborator

I'd personally prefer using u'...' strings and dropping Python 3.2 support, like some other testing tools (like coverage.py or hypothesis) already did.

@abusalimov
Copy link
Collaborator

@The-Compiler I agree, but let's wait at least until pytest-core drops 3.2 support first. After all, Python 2.6 support (which is about to be dropped in pytest 2.9) has been added just recently (#17). It would be unreasonable to abandon 3.2, but retain 2.6 compatibility.

Another option is to use u'...' literals and skip the test for Python 3.2. @sirex what do you think?

@sirex
Copy link
Contributor Author

sirex commented Jan 4, 2016

To leave 3.2 support, while pytest-core still supports it seems reasonable to me.

But for this one unicode test I can add skip condition for 3.2, just to remove this _totext workaround.

@abusalimov
Copy link
Collaborator

just to remove this _totext workaround.

This is exactly what I meant 👍

@sirex
Copy link
Contributor Author

sirex commented Jan 4, 2016

Can't skip py32, because it fails to load whole file containing u''. So instead just added small u() lambdas that does just smallest minimum needed for tests to support all pythons.

@abusalimov
Copy link
Collaborator

LGTM! Could you squash the whole branch into a single commit, please? 🏁

@The-Compiler
Copy link
Collaborator

LGTM as well!

abusalimov added a commit that referenced this pull request Jan 5, 2016
@abusalimov abusalimov merged commit faba94c into eisensheng:develop Jan 5, 2016
eisensheng added a commit that referenced this pull request Jan 18, 2016
bors bot added a commit to aragilar/venv_tools that referenced this pull request Aug 13, 2021
7: Pin pytest-catchlog to latest version 1.2.2 r=aragilar a=pyup-bot


This PR pins [pytest-catchlog](https://pypi.org/project/pytest-catchlog) to the latest release **1.2.2**.



<details>
  <summary>Changelog</summary>
  
  
   ### 1.2.2
   ```
   -------------

Released on 2016-01-24 UTC.

- [Bugfix] `30`_ `31`_ - Fix ``unicode`` vs ``str`` compatibility issues between Python2 and Python3.
  (Thanks goes to `sirex`_ for reporting the issue and providing a fix!)

.. _30: eisensheng/pytest-catchlog#30
.. _31: eisensheng/pytest-catchlog#31
.. _sirex: https://github.com/sirex
   ```
   
  
  
   ### 1.2.1
   ```
   -------------

Released on 2015-12-07.

- [Bugfix] 18 - Allow ``caplog.records()`` to be modified.  Thanks to Eldar Abusalimov for the PR and Marco Nenciarini for reporting the issue.
- [Bugfix] 15 17 - Restore Python 2.6 compatibility. (Thanks to Marco Nenciarini!)

.. attention::
    Deprecation warning: the following objects (i.e. functions, properties)
    are slated for removal in the next major release.

    - ``caplog.at_level`` and ``caplog.set_level`` should be used instead of
      ``caplog.atLevel`` and ``caplog.setLevel``.

      The methods ``caplog.atLevel`` and ``caplog.setLevel`` are still
      available but deprecated and not supported since they don&#39;t follow
      the PEP8 convention for method names.

    - ``caplog.text``, ``caplog.records`` and
      ``caplog.record_tuples`` were turned into properties.
      They still can be used as regular methods for backward compatibility,
      but that syntax is considered deprecated and scheduled for removal in
      the next major release.
   ```
   
  
  
   ### 1.2
   ```
   -----------

Released on 2015-11-08.

- [Feature] 6 - Configure logging message and date format through ini file.
- [Feature] 7 - Also catch logs from setup and teardown stages.
- [Feature] 7 - Replace deprecated ``__multicall__`` use to support future Py.test releases.
- [Feature] 11 - reintroduce ``setLevel`` and ``atLevel`` to retain backward compatibility with pytest-capturelog.  Also the members ``text``, ``records`` and ``record_tuples`` of the ``caplog`` fixture can be used as properties now.

Special thanks for this release goes to Eldar Abusalimov.  He provided all of the changed features.
   ```
   
  
  
   ### 1.1
   ```
   -----------

Released on 2015-06-07.

- 2 - Explicitly state Python3 support and add configuration for running
  tests with tox on multiple Python versions. (Thanks to Jeremy Bowman!)
- Add an option to silence logs completely on the terminal.
   ```
   
  
  
   ### 1.0
   ```
   -----------

Released on 2014-12-08.

- Add ``record_tuples`` for comparing recorded log entries against expected
  log entries with their logger name, severity and formatted message.
   ```
   
  
</details>


 

<details>
  <summary>Links</summary>
  
  - PyPI: https://pypi.org/project/pytest-catchlog
  - Changelog: https://pyup.io/changelogs/pytest-catchlog/
  - Repo: https://github.com/eisensheng/pytest-catchlog
</details>



Co-authored-by: pyup-bot <github-bot@pyup.io>
bors bot added a commit to aragilar/venv_tools that referenced this pull request Aug 13, 2021
18: Pin pytest-catchlog to latest version 1.2.2 r=aragilar a=pyup-bot


This PR pins [pytest-catchlog](https://pypi.org/project/pytest-catchlog) to the latest release **1.2.2**.



<details>
  <summary>Changelog</summary>
  
  
   ### 1.2.2
   ```
   -------------

Released on 2016-01-24 UTC.

- [Bugfix] `30`_ `31`_ - Fix ``unicode`` vs ``str`` compatibility issues between Python2 and Python3.
  (Thanks goes to `sirex`_ for reporting the issue and providing a fix!)

.. _30: eisensheng/pytest-catchlog#30
.. _31: eisensheng/pytest-catchlog#31
.. _sirex: https://github.com/sirex
   ```
   
  
  
   ### 1.2.1
   ```
   -------------

Released on 2015-12-07.

- [Bugfix] 18 - Allow ``caplog.records()`` to be modified.  Thanks to Eldar Abusalimov for the PR and Marco Nenciarini for reporting the issue.
- [Bugfix] 15 17 - Restore Python 2.6 compatibility. (Thanks to Marco Nenciarini!)

.. attention::
    Deprecation warning: the following objects (i.e. functions, properties)
    are slated for removal in the next major release.

    - ``caplog.at_level`` and ``caplog.set_level`` should be used instead of
      ``caplog.atLevel`` and ``caplog.setLevel``.

      The methods ``caplog.atLevel`` and ``caplog.setLevel`` are still
      available but deprecated and not supported since they don&#39;t follow
      the PEP8 convention for method names.

    - ``caplog.text``, ``caplog.records`` and
      ``caplog.record_tuples`` were turned into properties.
      They still can be used as regular methods for backward compatibility,
      but that syntax is considered deprecated and scheduled for removal in
      the next major release.
   ```
   
  
  
   ### 1.2
   ```
   -----------

Released on 2015-11-08.

- [Feature] 6 - Configure logging message and date format through ini file.
- [Feature] 7 - Also catch logs from setup and teardown stages.
- [Feature] 7 - Replace deprecated ``__multicall__`` use to support future Py.test releases.
- [Feature] 11 - reintroduce ``setLevel`` and ``atLevel`` to retain backward compatibility with pytest-capturelog.  Also the members ``text``, ``records`` and ``record_tuples`` of the ``caplog`` fixture can be used as properties now.

Special thanks for this release goes to Eldar Abusalimov.  He provided all of the changed features.
   ```
   
  
  
   ### 1.1
   ```
   -----------

Released on 2015-06-07.

- 2 - Explicitly state Python3 support and add configuration for running
  tests with tox on multiple Python versions. (Thanks to Jeremy Bowman!)
- Add an option to silence logs completely on the terminal.
   ```
   
  
  
   ### 1.0
   ```
   -----------

Released on 2014-12-08.

- Add ``record_tuples`` for comparing recorded log entries against expected
  log entries with their logger name, severity and formatted message.
   ```
   
  
</details>


 

<details>
  <summary>Links</summary>
  
  - PyPI: https://pypi.org/project/pytest-catchlog
  - Changelog: https://pyup.io/changelogs/pytest-catchlog/
  - Repo: https://github.com/eisensheng/pytest-catchlog
</details>



Co-authored-by: pyup-bot <github-bot@pyup.io>
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

Successfully merging this pull request may close these issues.

3 participants