Repository: koodaamo/tnefparse (language: python)

Issue:
deprecation warning
e.g. run `tox - e py38`

```
tests/test_decoding.py::test_zip
  /home/jugmac00/Projects/tnef-parallel/tnefparse/tnefparse/tnef.py:403: DeprecationWarning: passing bytes to tnef.to_zip will be deprecated, pass a TNEF object instead
    warnings.warn(msg, DeprecationWarning)
```


Discussion / hints:
Hey!
Do you want to update the tests to use a TNEF object instead of passing bytes?
Sounds like a good plan!
If no one is assigned this issue then I would like to work on this
Sure, go ahead!
Do not forget to add yourself to `HISTORY.rst`.

Fix patch:
diff --git a/HISTORY.rst b/HISTORY.rst
index 66d3c9f..a7eb43f 100644
--- a/HISTORY.rst
+++ b/HISTORY.rst
@@ -10,6 +10,7 @@ tnefparse 1.4.0 (unreleased)
 - remove deprecated parseFile & raw_mapi functions
 - fix str representation for TNEF class (jugmac00)
 - prefer `getattr` over `eval` (eumiro)
+- fix `test_zip` deprecation warning for bytes (1nF0rmed)
 
 tnefparse 1.3.1 (2020-09-30)
 =============================


Test patch:
diff --git a/tests/test_decoding.py b/tests/test_decoding.py
index 464db5d..339b6e8 100644
--- a/tests/test_decoding.py
+++ b/tests/test_decoding.py
@@ -1,6 +1,7 @@
 import logging
 import os
 import tempfile
+import pytest
 
 from tnefparse import TNEF
 from tnefparse.tnef import to_zip
@@ -106,10 +107,11 @@ def test_decode(tnefspec):
 
 def test_zip():
     # remove this test once tnef.to_zip(bytes) is no longer supported
-    with open(datadir + os.sep + 'one-file.tnef', "rb") as tfile:
-        zip_data = to_zip(tfile.read())
-        with tempfile.TemporaryFile() as out:
-            out.write(zip_data)
+    with pytest.deprecated_call():
+        with open(datadir + os.sep + 'one-file.tnef', "rb") as tfile:
+            zip_data = to_zip(tfile.read())
+            with tempfile.TemporaryFile() as out:
+                out.write(zip_data)
 
 
 def to_shortname(longname):