diff --git a/tests/utils.c b/tests/utils.c
index 0f10e7743c41cb7efb568c1e220e25097e05a918..eb98c8f838c592844c64293dfeb4c7fa55165b10 100644
--- a/tests/utils.c
+++ b/tests/utils.c
@@ -145,7 +145,9 @@ main (int argc,
       char **argv)
 {
   g_test_init (&argc, &argv, NULL);
+#if GLIB_CHECK_VERSION(2, 38, 0)
   g_test_set_nonfatal_assertions ();
+#endif
 
   g_test_add ("/build-filename", Fixture, NULL, setup,
               test_build_filename, teardown);