diff --git a/pkgs/development/python-modules/html5lib/default.nix b/pkgs/development/python-modules/html5lib/default.nix
index 08ea5a2b3e98..58da63d02edd 100644
--- a/pkgs/development/python-modules/html5lib/default.nix
+++ b/pkgs/development/python-modules/html5lib/default.nix
@@ -1,6 +1,7 @@
{ lib
, buildPythonPackage
, fetchPypi
+, fetchpatch
, six
, webencodings
, mock
@@ -17,6 +18,15 @@ buildPythonPackage rec {
sha256 = "b2e5b40261e20f354d198eae92afc10d750afb487ed5e50f9c4eaf07c184146f";
};
+ patches = [
+ # Fix compatibility with pytest 6.
+ # Will be included in the next release after 1.1.
+ (fetchpatch {
+ url = "https://github.com/html5lib/html5lib-python/commit/2c19b9899ab3a3e8bd0ca35e5d78544334204169.patch";
+ sha256 = "sha256-VGCeB6o2QO/skeCZs8XLPfgEYVOSRL8cCpG7ajbZWEs=";
+ })
+ ];
+
propagatedBuildInputs = [
six
webencodings