diff --git a/packages/hxtorch/package.py b/packages/hxtorch/package.py
index eac2bab6d6e8c918a4ad17fb63468f0902efcbb5..19253f69013aa92bc450123211cc8350f46ac279 100644
--- a/packages/hxtorch/package.py
+++ b/packages/hxtorch/package.py
@@ -4,6 +4,8 @@
 # SPDX-License-Identifier: (Apache-2.0 OR MIT)
 import os
 import unittest.mock
+import sys
+import xml.etree.ElementTree as ET
 
 from spack import *
 from spack.util.environment import EnvironmentModifications
@@ -171,7 +173,18 @@ class Hxtorch(WafPackage):
 
     def build_test(self):
         self.builder.waf('build', '--test-execall')
-        copy_tree('build/test_results', join_path(self.prefix, '.build'))
+        copy_tree('build/test_results', join_path(self.prefix, ".build"))
+        copy_tree('build/test_results', join_path(self.stage.path, ".install_time_tests"))
+        # propagate failures from junit output to spack
+        tree = ET.parse('build/test_results/summary.xml')
+        for testsuite in tree.getroot():
+            for testcase in testsuite:
+                for elem in testcase:
+                    if (elem.tag == 'failure') and not (
+                            elem.get('message').startswith("pylint:") or
+                            elem.get('message').startswith("pycodestyle:") or
+                            ("OK" in elem.get('message') and "Segmentation fault" in elem.get('message'))):
+                        raise RuntimeError("Failed test found: {}".format(testcase.get('name')))
 
     def install_args(self):
         args = ['--test-execnone']
diff --git a/packages/pynn-brainscales/package.py b/packages/pynn-brainscales/package.py
index df45a081fc406d6ceee67616dc868f860befcbd2..e548bb8a395a9a56253311412aa74739721dabc1 100644
--- a/packages/pynn-brainscales/package.py
+++ b/packages/pynn-brainscales/package.py
@@ -4,6 +4,8 @@
 # SPDX-License-Identifier: (Apache-2.0 OR MIT)
 import os
 import unittest.mock
+import sys
+import xml.etree.ElementTree as ET
 
 from spack import *
 from spack.util.environment import EnvironmentModifications
@@ -170,7 +172,18 @@ class PynnBrainscales(WafPackage):
 
     def build_test(self):
         self.builder.waf('build', '--test-execall')
-        copy_tree('build/test_results', join_path(self.prefix, '.build'))
+        copy_tree('build/test_results', join_path(self.prefix, ".build"))
+        copy_tree('build/test_results', join_path(self.stage.path, ".install_time_tests"))
+        # propagate failures from junit output to spack
+        tree = ET.parse('build/test_results/summary.xml')
+        for testsuite in tree.getroot():
+            for testcase in testsuite:
+                for elem in testcase:
+                    if (elem.tag == 'failure') and not (
+                            elem.get('message').startswith("pylint:") or
+                            elem.get('message').startswith("pycodestyle:") or
+                            ("OK" in elem.get('message') and "Segmentation fault" in elem.get('message'))):
+                        raise RuntimeError("Failed test found: {}".format(testcase.get('name')))
 
     def install_args(self):
         args = ['--test-execnone']