From 2faa874b3bb6b8c661adfdeb0e896437fb87a63a Mon Sep 17 00:00:00 2001
From: SimplyLogan <47579821+loganuk@users.noreply.github.com>
Date: Sun, 5 Oct 2025 23:25:51 +0100
Subject: [PATCH] Speed up Mapper testing with a prefix "maptest_" in VSCode
(#93238)
## About The Pull Request
One of the development hell cycles with mapping is how long it takes to
fix quality or run issues with maps.
By adding a prefix called "maptest_" to some of the unit tests it allows
mappers to only target some tests instead of the usual 350+ tests to run
each time or trying to trigger them individually and faffing.
This does not rename the unit test files themselves to preserve history
but just the "/datum/unit_test/" in each file.
This does not break the current CI or obstruct other tests - A few other
map files that call these tests specifically have been edited to point
at the new datum name.
This assumes you are using the TG testing extension to do this.
| All Tests | maptest_ |
|--------|--------|
|
|
|
|
|
|
## Why It's Good For The Game
- Should make it easier for mappers to test locally, saving CI/Github
resource for TG
- Mappers can now test their work 56% faster
## Changelog
:cl:
code: Mappers can now run just mapping unit tests - Should be 56% faster
- Should have no player impact
/:cl:
Co-authored-by: loganuk
---
_maps/gateway_test.json | 4 ++--
_maps/multiz_debug.json | 4 ++--
_maps/runtimestation.json | 4 ++--
code/modules/mapping/ruins.dm | 4 ++--
code/modules/unit_tests/area_contents.dm | 4 ++--
code/modules/unit_tests/baseturfs.dm | 18 +++++++++---------
code/modules/unit_tests/get_turf_pixel.dm | 4 ++--
code/modules/unit_tests/load_map_security.dm | 6 +++---
code/modules/unit_tests/map_landmarks.dm | 4 ++--
.../unit_tests/mapload_space_verification.dm | 6 +++---
code/modules/unit_tests/mapping.dm | 4 ++--
.../unit_tests/mapping_nearstation_test.dm | 4 ++--
code/modules/unit_tests/modular_map_loader.dm | 4 ++--
code/modules/unit_tests/required_map_items.dm | 6 +++---
code/modules/unit_tests/turf_icons.dm | 4 ++--
15 files changed, 40 insertions(+), 40 deletions(-)
diff --git a/_maps/gateway_test.json b/_maps/gateway_test.json
index df38ec4c5b8..4acdadf0644 100644
--- a/_maps/gateway_test.json
+++ b/_maps/gateway_test.json
@@ -8,8 +8,8 @@
"ignored_unit_tests": [
"/datum/unit_test/antag_moodlets",
"/datum/unit_test/cargo_dep_order_locations",
- "/datum/unit_test/job_roundstart_spawnpoints",
- "/datum/unit_test/required_map_items",
+ "/datum/unit_test/maptest_job_roundstart_spawnpoints",
+ "/datum/unit_test/maptest_required_map_items",
"/datum/unit_test/space_dragon_expiration",
"/datum/unit_test/spy_bounty",
"/datum/unit_test/traitor"
diff --git a/_maps/multiz_debug.json b/_maps/multiz_debug.json
index af3ffa35212..ba9b83d5dc7 100644
--- a/_maps/multiz_debug.json
+++ b/_maps/multiz_debug.json
@@ -5,8 +5,8 @@
"map_file": "multiz.dmm",
"ignored_unit_tests": [
"/datum/unit_test/cargo_dep_order_locations",
- "/datum/unit_test/job_roundstart_spawnpoints",
- "/datum/unit_test/required_map_items",
+ "/datum/unit_test/maptest_job_roundstart_spawnpoints",
+ "/datum/unit_test/maptest_required_map_items",
"/datum/unit_test/spy_bounty"
],
"traits": [
diff --git a/_maps/runtimestation.json b/_maps/runtimestation.json
index 12f854ce425..715d924d5af 100644
--- a/_maps/runtimestation.json
+++ b/_maps/runtimestation.json
@@ -6,8 +6,8 @@
"space_ruin_levels": 1,
"ignored_unit_tests": [
"/datum/unit_test/cargo_dep_order_locations",
- "/datum/unit_test/job_roundstart_spawnpoints",
- "/datum/unit_test/required_map_items",
+ "/datum/unit_test/maptest_job_roundstart_spawnpoints",
+ "/datum/unit_test/maptest_required_map_items",
"/datum/unit_test/spy_bounty"
],
"shuttles": {
diff --git a/code/modules/mapping/ruins.dm b/code/modules/mapping/ruins.dm
index c157636b121..2e81e198737 100644
--- a/code/modules/mapping/ruins.dm
+++ b/code/modules/mapping/ruins.dm
@@ -91,7 +91,7 @@
var/list/forced_ruins = list() //These go first on the z level associated (same random one by default) or if the assoc value is a turf to the specified turf.
var/list/ruins_available = list() //we can try these in the current pass
- if(PERFORM_ALL_TESTS(log_mapping))
+ if(PERFORM_ALL_TESTS(maptest_log_mapping))
log_mapping("All ruins being loaded for map testing.")
switch(mineral_budget_update) //If we use more map configurations, add another case
@@ -104,7 +104,7 @@
for(var/key in ruins)
var/datum/map_template/ruin/R = ruins[key]
- if(PERFORM_ALL_TESTS(log_mapping))
+ if(PERFORM_ALL_TESTS(maptest_log_mapping))
R.cost = 0
R.allow_duplicates = FALSE // no multiples for testing
R.always_place = !R.unpickable // unpickable ruin means it spawns as a set with another ruin
diff --git a/code/modules/unit_tests/area_contents.dm b/code/modules/unit_tests/area_contents.dm
index 71fda983c61..c53a9143e6a 100644
--- a/code/modules/unit_tests/area_contents.dm
+++ b/code/modules/unit_tests/area_contents.dm
@@ -1,9 +1,9 @@
/// Verifies that an area's perception of their "turfs" is correct, and no other area overlaps with them
/// Quite slow, but needed
-/datum/unit_test/area_contents
+/datum/unit_test/maptest_area_contents
priority = TEST_LONGER
-/datum/unit_test/area_contents/Run()
+/datum/unit_test/maptest_area_contents/Run()
// First, we check that there are no entries in more then one area
// That or duplicate entries
for (var/area/area_to_test in GLOB.areas)
diff --git a/code/modules/unit_tests/baseturfs.dm b/code/modules/unit_tests/baseturfs.dm
index 3150aac342f..3cfe7c0f918 100644
--- a/code/modules/unit_tests/baseturfs.dm
+++ b/code/modules/unit_tests/baseturfs.dm
@@ -5,9 +5,9 @@
turf.assemble_baseturfs(initial(turf.baseturfs))
/// Validates that unmodified baseturfs tear down properly
-/datum/unit_test/baseturfs_unmodified_scrape
+/datum/unit_test/maptest_baseturfs_unmodified_scrape
-/datum/unit_test/baseturfs_unmodified_scrape/Run()
+/datum/unit_test/maptest_baseturfs_unmodified_scrape/Run()
// What this is specifically doesn't matter, just as long as the test is built for it
TEST_ASSERT_EQUAL(run_loc_floor_bottom_left.type, EXPECTED_FLOOR_TYPE, "run_loc_floor_bottom_left should be an iron floor")
@@ -21,14 +21,14 @@
run_loc_floor_bottom_left.ScrapeAway()
TEST_ASSERT_EQUAL(run_loc_floor_bottom_left.type, /turf/open/space, "Space should scrape away to space")
-/datum/unit_test/baseturfs_unmodified_scrape/Destroy()
+/datum/unit_test/maptest_baseturfs_unmodified_scrape/Destroy()
RESET_TO_EXPECTED(run_loc_floor_bottom_left)
return ..()
/// Validates that specially placed baseturfs tear down properly
-/datum/unit_test/baseturfs_placed_on_top
+/datum/unit_test/maptest_baseturfs_placed_on_top
-/datum/unit_test/baseturfs_placed_on_top/Run()
+/datum/unit_test/maptest_baseturfs_placed_on_top/Run()
TEST_ASSERT_EQUAL(run_loc_floor_bottom_left.type, EXPECTED_FLOOR_TYPE, "run_loc_floor_bottom_left should be an iron floor")
// Do this instead of just ChangeTurf to guarantee that baseturfs is completely default on-init behavior
@@ -40,14 +40,14 @@
run_loc_floor_bottom_left.ScrapeAway()
TEST_ASSERT_EQUAL(run_loc_floor_bottom_left.type, EXPECTED_FLOOR_TYPE, "Rock wall should've been scraped off, back into the expected type")
-/datum/unit_test/baseturfs_placed_on_top/Destroy()
+/datum/unit_test/maptest_baseturfs_placed_on_top/Destroy()
RESET_TO_EXPECTED(run_loc_floor_bottom_left)
return ..()
/// Validates that specially placed baseturfs BELOW tear down properly
-/datum/unit_test/baseturfs_placed_on_bottom
+/datum/unit_test/maptest_baseturfs_placed_on_bottom
-/datum/unit_test/baseturfs_placed_on_bottom/Run()
+/datum/unit_test/maptest_baseturfs_placed_on_bottom/Run()
TEST_ASSERT_EQUAL(run_loc_floor_bottom_left.type, EXPECTED_FLOOR_TYPE, "run_loc_floor_bottom_left should be an iron floor")
// Do this instead of just ChangeTurf to guarantee that baseturfs is completely default on-init behavior
@@ -68,7 +68,7 @@
run_loc_floor_bottom_left.ScrapeAway()
TEST_ASSERT_EQUAL(run_loc_floor_bottom_left.type, /turf/open/floor/plating, "Rock wall should've scraped down back to plating (because it's a wall)")
-/datum/unit_test/baseturfs_placed_on_bottom/Destroy()
+/datum/unit_test/maptest_baseturfs_placed_on_bottom/Destroy()
RESET_TO_EXPECTED(run_loc_floor_bottom_left)
return ..()
diff --git a/code/modules/unit_tests/get_turf_pixel.dm b/code/modules/unit_tests/get_turf_pixel.dm
index 8cd292d3b6c..15628f009fa 100644
--- a/code/modules/unit_tests/get_turf_pixel.dm
+++ b/code/modules/unit_tests/get_turf_pixel.dm
@@ -1,8 +1,8 @@
///ensures that get_turf_pixel() returns turfs within the bounds of the map,
///even when called on a movable with its sprite out of bounds
-/datum/unit_test/get_turf_pixel
+/datum/unit_test/maptest_get_turf_pixel
-/datum/unit_test/get_turf_pixel/Run()
+/datum/unit_test/maptest_get_turf_pixel/Run()
//we need long larry to peek over the top edge of the earth
var/turf/north = locate(1, world.maxy, run_loc_floor_bottom_left.z)
diff --git a/code/modules/unit_tests/load_map_security.dm b/code/modules/unit_tests/load_map_security.dm
index a06f184adea..ec73fba343f 100644
--- a/code/modules/unit_tests/load_map_security.dm
+++ b/code/modules/unit_tests/load_map_security.dm
@@ -2,9 +2,9 @@
#define VALID_TEST_MAP "runtimestation"
/// Tests to ensure we can load a map from a whitelisted directory (_maps), but not a non-whitelisted directory (i.e "fartyShitPants")
-/datum/unit_test/load_map_security
+/datum/unit_test/maptest_load_map_security
-/datum/unit_test/load_map_security/Run()
+/datum/unit_test/maptest_load_map_security/Run()
// Copy our valid map into a bad directory
// We can technically load from /unitTestTempDir by passing it in our map name
@@ -34,7 +34,7 @@
TEST_ASSERT(bad_config.defaulted, "Loaded from non-whitelisted directory: data/load_map_security_temp/[VALID_TEST_MAP]")
-/datum/unit_test/load_map_security/Destroy()
+/datum/unit_test/maptest_load_map_security/Destroy()
// Clean up our temp directory
fdel("data/load_map_security_temp/")
return ..()
diff --git a/code/modules/unit_tests/map_landmarks.dm b/code/modules/unit_tests/map_landmarks.dm
index 9d48785e350..f81b67aa667 100644
--- a/code/modules/unit_tests/map_landmarks.dm
+++ b/code/modules/unit_tests/map_landmarks.dm
@@ -1,7 +1,7 @@
/// Tests that [/datum/job/proc/get_default_roundstart_spawn_point] returns a landmark from all joinable jobs.
-/datum/unit_test/job_roundstart_spawnpoints
+/datum/unit_test/maptest_job_roundstart_spawnpoints
-/datum/unit_test/job_roundstart_spawnpoints/Run()
+/datum/unit_test/maptest_job_roundstart_spawnpoints/Run()
for(var/datum/job/job as anything in SSjob.joinable_occupations)
if(job.spawn_positions <= 0)
// Zero spawn positions means we don't need to care if they don't have a roundstart landmark
diff --git a/code/modules/unit_tests/mapload_space_verification.dm b/code/modules/unit_tests/mapload_space_verification.dm
index 5b27a77cb43..c7c9845956a 100644
--- a/code/modules/unit_tests/mapload_space_verification.dm
+++ b/code/modules/unit_tests/mapload_space_verification.dm
@@ -1,10 +1,10 @@
/// Verifies that there are no space turfs inside a station area, or on any planetary z-level. Sometimes, these are introduced during the load of the map and are not present in the DMM itself.
/// Let's just make sure that we have a stop-gap measure in place to catch these if they pop up so we don't put it onto production servers should something errant come up.
-/datum/unit_test/mapload_space_verification
+/datum/unit_test/maptest_mapload_space_verification
// This test is quite taxing time-wise, so let's run it later than other faster tests.
priority = TEST_LONGER
-/datum/unit_test/mapload_space_verification/Run()
+/datum/unit_test/maptest_mapload_space_verification/Run()
// Is our current map a planetary station (NO space turfs allowed)? If so, check for ANY space turfs.
if(SSmapping.is_planetary())
validate_planetary_map()
@@ -41,7 +41,7 @@
/// Verifies that there are ZERO space turfs on a valid planetary station. We NEVER want space turfs here, so we do not check for /area/space here since something completely undesirable is happening.
/// There are also a few considerations specific to planetary stations included within, so let's spin it out into a separate proc for clarity.
-/datum/unit_test/mapload_space_verification/proc/validate_planetary_map()
+/datum/unit_test/maptest_mapload_space_verification/proc/validate_planetary_map()
// We want to get both the station level and the mining level (if the two are seperate for any reason).
var/list/testable_levels = list()
testable_levels += SSmapping.levels_by_trait(ZTRAIT_STATION) // Station z-levels get to be in by default because they can derail an entire round and cause LINDA to weep if a space turf is present.
diff --git a/code/modules/unit_tests/mapping.dm b/code/modules/unit_tests/mapping.dm
index ff6a2577917..6b1509ba64e 100644
--- a/code/modules/unit_tests/mapping.dm
+++ b/code/modules/unit_tests/mapping.dm
@@ -1,9 +1,9 @@
/// Conveys all log_mapping messages as unit test failures, as they all indicate mapping problems.
-/datum/unit_test/log_mapping
+/datum/unit_test/maptest_log_mapping
// Happen before all other tests, to make sure we only capture normal mapping logs.
priority = TEST_PRE
-/datum/unit_test/log_mapping/Run()
+/datum/unit_test/maptest_log_mapping/Run()
var/static/regex/test_areacoord_regex = regex(@"\(-?\d+,-?\d+,(-?\d+)\)")
for(var/log_entry in GLOB.unit_test_mapping_logs)
diff --git a/code/modules/unit_tests/mapping_nearstation_test.dm b/code/modules/unit_tests/mapping_nearstation_test.dm
index d428b826634..39898432fa0 100644
--- a/code/modules/unit_tests/mapping_nearstation_test.dm
+++ b/code/modules/unit_tests/mapping_nearstation_test.dm
@@ -1,8 +1,8 @@
///Detects movables that may have been accidentally placed in space, as well as movables which do not have the proper nearspace area (meaning they aren't lit properly.)
-/datum/unit_test/mapping_nearstation_test
+/datum/unit_test/maptest_mapping_nearstation_test
priority = TEST_PRE
-/datum/unit_test/mapping_nearstation_test/Run()
+/datum/unit_test/maptest_mapping_nearstation_test/Run()
if(SSmapping.is_planetary())
return //No need to test for orphaned spaced atoms on this map.
diff --git a/code/modules/unit_tests/modular_map_loader.dm b/code/modules/unit_tests/modular_map_loader.dm
index fe6f00b6821..66caf39fccb 100644
--- a/code/modules/unit_tests/modular_map_loader.dm
+++ b/code/modules/unit_tests/modular_map_loader.dm
@@ -1,6 +1,6 @@
-/datum/unit_test/modular_map_loader
+/datum/unit_test/maptest_modular_map_loader
-/datum/unit_test/modular_map_loader/Run()
+/datum/unit_test/maptest_modular_map_loader/Run()
for (var/obj/modular_map_root/map_root_type as anything in subtypesof(/obj/modular_map_root))
var/config_file = initial(map_root_type.config_file)
if (!fexists(config_file))
diff --git a/code/modules/unit_tests/required_map_items.dm b/code/modules/unit_tests/required_map_items.dm
index 145f5fd34ce..a1b1f516d7f 100644
--- a/code/modules/unit_tests/required_map_items.dm
+++ b/code/modules/unit_tests/required_map_items.dm
@@ -5,14 +5,14 @@
* - Add the typepath(s) to setup_expected_types
* - In the type's initialize, REGISTER_REQUIRED_MAP_ITEM() a minimum and maximum
*/
-/datum/unit_test/required_map_items
+/datum/unit_test/maptest_required_map_items
/// A list of all typepaths that we expect to be in the required items list
var/list/expected_types = list()
/// Used to fill the expected types list with all the types we look for on the map.
/// This list will just be full of typepaths that we expect.
/// More detailed information about each item (mainly, how much of each should exist) is set on a per item basis
-/datum/unit_test/required_map_items/proc/setup_expected_types()
+/datum/unit_test/maptest_required_map_items/proc/setup_expected_types()
expected_types += subtypesof(/obj/item/stamp/head)
expected_types += subtypesof(/obj/machinery/modular_computer/preset/cargochat)
@@ -23,7 +23,7 @@
expected_types += /obj/machinery/drone_dispenser
expected_types += /obj/item/piggy_bank/vault
-/datum/unit_test/required_map_items/Run()
+/datum/unit_test/maptest_required_map_items/Run()
setup_expected_types()
var/list/required_map_items = GLOB.required_map_items.Copy()
diff --git a/code/modules/unit_tests/turf_icons.dm b/code/modules/unit_tests/turf_icons.dm
index 945130ada0c..e0f6bad45a3 100644
--- a/code/modules/unit_tests/turf_icons.dm
+++ b/code/modules/unit_tests/turf_icons.dm
@@ -1,8 +1,8 @@
/// Makes sure turf icons actually exist. :)
-/datum/unit_test/turf_icons
+/datum/unit_test/maptest_turf_icons
var/modular_mineral_turf_file //= 'icons/turf/mining.dmi' //MODULARITY SUPPORT - insert your snowflake MAP_SWITCH icon file here if you use that define.
-/datum/unit_test/turf_icons/Run()
+/datum/unit_test/maptest_turf_icons/Run()
for(var/turf/turf_path as anything in (subtypesof(/turf) - typesof(/turf/closed/mineral)))
var/icon_state = initial(turf_path.icon_state)