diff --git a/tests/integration_tests/test_codegen.py b/tests/integration_tests/test_codegen.py
index c8e7fe04f..411d8fbbe 100644
--- a/tests/integration_tests/test_codegen.py
+++ b/tests/integration_tests/test_codegen.py
@@ -1,6 +1,7 @@
 import importlib
 import pkgutil
 import sys
+from contextlib import suppress
 from os.path import dirname, join
 from shutil import rmtree
 from unittest import IsolatedAsyncioTestCase
@@ -52,7 +53,9 @@ async def test_codegen(self):
 
                     import_submodules(config.package)
                 except Exception as exc:
-                    rmtree('tmp_test_dipdup')
+                    with suppress(FileNotFoundError):
+                        rmtree('tmp_test_dipdup')
                     raise exc
                 else:
-                    rmtree('tmp_test_dipdup')
+                    with suppress(FileNotFoundError):
+                        rmtree('tmp_test_dipdup')