diff --git a/packages/p/python-pylzma/.files b/packages/p/python-pylzma/.files
index 4fff68416b1..f36903da34a 100644
Binary files a/packages/p/python-pylzma/.files and b/packages/p/python-pylzma/.files differ
diff --git a/packages/p/python-pylzma/.rev b/packages/p/python-pylzma/.rev
index ed15d3f9416..bfee0875cc2 100644
--- a/packages/p/python-pylzma/.rev
+++ b/packages/p/python-pylzma/.rev
@@ -36,4 +36,17 @@
662480
+
+ f056ed9b99844dbd51a0a80f8932b46c
+ 0.5.0
+
+ dimstar_suse
+ - Fix the patch metadata in the SPEC file.
+
+- %check: use %pyunittest_arch rpm macro
+- added patches
+ fix https://github.com/fancycode/pylzma/issues/76
+ + python-pylzma-test-python3.patch
+ 919149
+
diff --git a/packages/p/python-pylzma/python-pylzma-test-python3.patch b/packages/p/python-pylzma/python-pylzma-test-python3.patch
new file mode 100644
index 00000000000..487ff1ce41f
--- /dev/null
+++ b/packages/p/python-pylzma/python-pylzma-test-python3.patch
@@ -0,0 +1,13 @@
+Index: pylzma-0.5.0/tests/test_usage.py
+===================================================================
+--- pylzma-0.5.0.orig/tests/test_usage.py 2018-09-26 20:36:11.000000000 +0200
++++ pylzma-0.5.0/tests/test_usage.py 2021-09-15 11:19:08.201378252 +0200
+@@ -38,7 +38,7 @@ sys.path.insert(0, ROOT)
+ def cleanup(path):
+ try:
+ shutil.rmtree(path)
+- except EnvironmentError, e:
++ except EnvironmentError as e:
+ if e.errno != errno.ENOENT:
+ raise
+
diff --git a/packages/p/python-pylzma/python-pylzma.changes b/packages/p/python-pylzma/python-pylzma.changes
index a0574c73df7..e87c1564199 100644
--- a/packages/p/python-pylzma/python-pylzma.changes
+++ b/packages/p/python-pylzma/python-pylzma.changes
@@ -1,3 +1,16 @@
+-------------------------------------------------------------------
+Wed Sep 15 12:08:00 UTC 2021 - Matej Cepl
+
+- Fix the patch metadata in the SPEC file.
+
+-------------------------------------------------------------------
+Wed Sep 15 09:20:27 UTC 2021 - pgajdos@suse.com
+
+- %check: use %pyunittest_arch rpm macro
+- added patches
+ fix https://github.com/fancycode/pylzma/issues/76
+ + python-pylzma-test-python3.patch
+
-------------------------------------------------------------------
Wed Jan 2 14:09:12 UTC 2019 - Martin Pluskal
diff --git a/packages/p/python-pylzma/python-pylzma.spec b/packages/p/python-pylzma/python-pylzma.spec
index 790c26d15d6..41b5be05f60 100644
--- a/packages/p/python-pylzma/python-pylzma.spec
+++ b/packages/p/python-pylzma/python-pylzma.spec
@@ -1,7 +1,7 @@
#
# spec file for package python-pylzma
#
-# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2021 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -26,6 +26,9 @@ License: LGPL-2.1-only
Group: Development/Languages/Python
URL: https://github.com/fancycode/pylzma
Source0: https://github.com/fancycode/pylzma/archive/v%{version}.tar.gz
+# PATCH-FIX-UPSTREAM python-pylzma-test-python3.patch gh#fancycode/pylzma#76 mcepl@suse.com
+# use python3 syntax in test_usage.py
+Patch0: python-pylzma-test-python3.patch
BuildRequires: %{python_module devel}
BuildRequires: %{python_module setuptools}
BuildRequires: fdupes
@@ -38,6 +41,7 @@ that has been compressed or can be decompressed by the LZMA library.
%prep
%setup -q -n %{oname}-%{version}
+%patch0 -p1
# Remove Shebang
sed -i '1d' py7zlib.py
@@ -50,7 +54,7 @@ sed -i '1d' py7zlib.py
%python_expand %fdupes %{buildroot}%{$python_sitearch}
%check
-%python_exec setup.py test
+%pyunittest_arch discover -v
%files %{python_files}
%license LICENSE