diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 66cc0dfac..ab1fcd173 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -100,6 +100,10 @@ if(ENABLE_PERF_TESTS)
     target_link_libraries(sr_perf sysrepo srobj)
 
     add_test(NAME sr_perf_1000_10 COMMAND sr_perf 1000 10)
+    set_property(TEST sr_perf_1000_10 APPEND PROPERTY ENVIRONMENT
+        "SYSREPO_REPOSITORY_PATH=${PROJECT_BINARY_DIR}/test_repositories/sr_perf"
+        "SYSREPO_SHM_PREFIX=_tests_sr_sr_perf"
+    )
 
     if(${CMAKE_VERSION} VERSION_GREATER "3.7")
         set_tests_properties(sr_perf_1000_10 PROPERTIES FIXTURES_REQUIRED tests_cleanup)
diff --git a/tests/perf.c b/tests/perf.c
index 4d99403e9..e345ab6af 100644
--- a/tests/perf.c
+++ b/tests/perf.c
@@ -839,14 +839,6 @@ sysrepo_init(const char *plg_name, struct test_state *state, uint32_t count)
     }
     mod_ds.plugin_name[5] = "JSON notif";
 
-    /* setup env */
-    if ((ret = setenv("SYSREPO_REPOSITORY_PATH", TESTS_REPO_DIR "/test_repositories/sr_perf", 1))) {
-        return ret;
-    }
-    if ((ret = setenv("SYSREPO_SHM_PREFIX", "_tests_sr_sr_perf", 1))) {
-        return ret;
-    }
-
     /* turn on logging */
     sr_log_stderr(SR_LL_WRN);