Skip to content

DeprecationWarning: use tobytes instead of tostring #4116

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

Closed
standage opened this issue Oct 11, 2018 · 2 comments
Closed

DeprecationWarning: use tobytes instead of tostring #4116

standage opened this issue Oct 11, 2018 · 2 comments

Comments

@standage
Copy link

I've had pytest pinned at 3.6.4 in one of my repos while waiting for #3749 to be resolved. It looks like it's been fixed since 3.8.1. w00t, good work!

However, all versions since 3.8.1 have introduced a new issue.

/projects/kevlar/kevlar/dump.py:108: DeprecationWarning: tostring() is deprecated. Use tobytes() instead.
  for read in dump(args.reads, refr, args.pair_mode, logstream=args.logfile):
/projects/kevlar/kevlar/dump.py:108: DeprecationWarning: tostring() is deprecated. Use tobytes() instead.
  for read in dump(args.reads, refr, args.pair_mode, logstream=args.logfile):
/projects/kevlar/kevlar/dump.py:108: DeprecationWarning: tostring() is deprecated. Use tobytes() instead.
  for read in dump(args.reads, refr, args.pair_mode, logstream=args.logfile):
/projects/kevlar/kevlar/dump.py:108: DeprecationWarning: tostring() is deprecated. Use tobytes() instead.
  for read in dump(args.reads, refr, args.pair_mode, logstream=args.logfile):
/projects/kevlar/kevlar/dump.py:108: DeprecationWarning: tostring() is deprecated. Use tobytes() instead.
  for read in dump(args.reads, refr, args.pair_mode, logstream=args.logfile):

/projects/kevlar/kevlar/tests/test_dump.py:38: DeprecationWarning: tostring() is deprecated. Use tobytes() instead.
  records = [r for r in kevlar.dump.dump(bamstream)]
/projects/kevlar/kevlar/tests/test_dump.py:38: DeprecationWarning: tostring() is deprecated. Use tobytes() instead.
  records = [r for r in kevlar.dump.dump(bamstream)]
/projects/kevlar/kevlar/tests/test_dump.py:38: DeprecationWarning: tostring() is deprecated. Use tobytes() instead.
  records = [r for r in kevlar.dump.dump(bamstream)]
/projects/kevlar/kevlar/tests/test_dump.py:38: DeprecationWarning: tostring() is deprecated. Use tobytes() instead.
  records = [r for r in kevlar.dump.dump(bamstream)]
/projects/kevlar/kevlar/tests/test_dump.py:38: DeprecationWarning: tostring() is deprecated. Use tobytes() instead.
  records = [r for r in kevlar.dump.dump(bamstream)]
/projects/kevlar/kevlar/tests/test_dump.py:38: DeprecationWarning: tostring() is deprecated. Use tobytes() instead.
  records = [r for r in kevlar.dump.dump(bamstream)]
/projects/kevlar/kevlar/tests/test_dump.py:38: DeprecationWarning: tostring() is deprecated. Use tobytes() instead.
  records = [r for r in kevlar.dump.dump(bamstream)]
/projects/kevlar/kevlar/tests/test_dump.py:38: DeprecationWarning: tostring() is deprecated. Use tobytes() instead.
  records = [r for r in kevlar.dump.dump(bamstream)]

/projects/kevlar/kevlar/dump.py:108: DeprecationWarning: tostring() is deprecated. Use tobytes() instead.
  for read in dump(args.reads, refr, args.pair_mode, logstream=args.logfile):
/projects/kevlar/kevlar/dump.py:108: DeprecationWarning: tostring() is deprecated. Use tobytes() instead.
  for read in dump(args.reads, refr, args.pair_mode, logstream=args.logfile):
/projects/kevlar/kevlar/dump.py:108: DeprecationWarning: tostring() is deprecated. Use tobytes() instead.
  for read in dump(args.reads, refr, args.pair_mode, logstream=args.logfile):
/projects/kevlar/kevlar/dump.py:108: DeprecationWarning: tostring() is deprecated. Use tobytes() instead.
  for read in dump(args.reads, refr, args.pair_mode, logstream=args.logfile):

/projects/kevlar/kevlar/tests/test_dump.py:66: DeprecationWarning: tostring() is deprecated. Use tobytes() instead.
  records = [r for r in kevlar.dump.dump(bamstream, refr, pairmode=mode)]

/projects/kevlar/kevlar/tests/test_dump.py:66: DeprecationWarning: tostring() is deprecated. Use tobytes() instead.
  records = [r for r in kevlar.dump.dump(bamstream, refr, pairmode=mode)]
/projects/kevlar/kevlar/tests/test_dump.py:66: DeprecationWarning: tostring() is deprecated. Use tobytes() instead.
  records = [r for r in kevlar.dump.dump(bamstream, refr, pairmode=mode)]

Reverting back to 3.6.4 fixed the issue. This is happening on Ubuntu 16.04. Unfortunately it may be a bit until I can provide a small reproducible example.

@nicoddemus
Copy link
Member

nicoddemus commented Oct 11, 2018

Hi @standage,

pytest 3.8 now shows deprecation warnings by default, so it is not an issue with pytest per-se.

You can fix the code, or ignore the warnings by adding this to your pytest.ini file:

[pytest]
filterwarnings=
	ignore:tostring.*is deprecated

I'm closing this for now, but feel free to follow up if you have any other questions. 👍

@standage
Copy link
Author

Thanks for the response.

The code directly referenced by the warning messages doesn't call any tostring method, anywhere in the entire module. It's likely calls to another module, pysam, that are problematic. In any case, thanks for letting me know how to silence the warnings, I'll see if I can come up with an example for the pysam developers.

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