Skip to content

fix: Minor test cleanup - #99

Merged
csmith49 merged 3 commits into
mainfrom
fix/tests-and-serialization
Sep 4, 2025
Merged

csmith49 merged 3 commits into
mainfrom
fix/tests-and-serialization

Conversation

@csmith49

@csmith49 csmith49 commented Sep 4, 2025

Copy link
Copy Markdown
Contributor

This PR moves a few tests from the old tests/core folder to tests/sdk. It also adds a new set of unit tests for serialization/deserialization of events using Pydantic.

Note that a few of these tests don't behave the way we'd expect. These are marked with comments in the test body. The tests pass and still check useful properties, but just note the implementation isn't quite where we want it to be.

@github-actions

github-actions Bot commented Sep 4, 2025 •

Copy link
Copy Markdown
Contributor

Coverage

Coverage Report
FileStmtsMissCoverMissing
openhands
   __init__.py10100% 
openhands/sdk
   __init__.py14285%22–23
   logger.py581475%28, 50, 57–60, 62–64, 102–103, 109–111
openhands/sdk/agent
   __init__.py30100% 
   base.py46491%36, 47, 83, 103
openhands/sdk/agent/agent
   __init__.py20100% 
   agent.py1032872%64–66, 99–100, 102–104, 106–108, 138, 152, 172, 201–206, 213–214, 218–220, 247, 254, 270
openhands/sdk/config
   __init__.py30100% 
   llm_config.py781284%107, 112, 120, 124–125, 127, 131–133, 146, 148, 152
   mcp_config.py16110932%29–30, 32–45, 63, 85–86, 88, 91–92, 97, 103–104, 106, 109–110, 115, 129–131, 133, 136–138, 140, 145, 151–153, 155–159, 161–162, 166–171, 177–179, 188–190, 206, 227–230, 232–233, 238–240, 242–243, 245, 249, 252–253, 256–262, 276, 278, 280–282, 285–287, 290–294, 296–301, 304–305, 308, 313–315, 318
openhands/sdk/context
   __init__.py40100% 
   agent_context.py442738%57–58, 60–65, 76, 79, 84, 86, 92, 104, 107, 109–110, 112–117, 122, 129–130, 135
   manager.py330%1, 4–5
   view.py473427%30, 46–50, 52, 59–62, 64–66, 68, 76–77, 81–86, 88–89, 91, 105–111, 113
openhands/sdk/context/condenser
   __init__.py30100% 
   condenser.py17382%68–69, 73
   no_op_condenser.py6183%13
openhands/sdk/context/microagents
   __init__.py40100% 
   exceptions.py5180%11
   microagent.py14310030%47, 50–51, 58, 71, 74–75, 77, 81, 84–86, 89–90, 98–100, 102–104, 107, 110, 113–118, 127–130, 132–135, 142–143, 151, 171, 178–181, 183, 209–210, 212–213, 218–219, 221, 224–225, 229, 233–234, 237, 256–257, 262–263, 265, 269, 276–278, 286–288, 304–305, 307–308, 311, 314–315, 318–322, 325–327, 330–335, 337–338, 340–342, 344–345, 347, 351
   types.py300100% 
openhands/sdk/context/utils
   __init__.py20100% 
   prompt.py30583%12, 15, 24, 44–45
openhands/sdk/conversation
   __init__.py50100% 
   conversation.py51884%65, 73, 81–83, 87–88, 115
   state.py25292%44–45
   types.py30100% 
   visualizer.py56983%38–39, 42, 107–108, 124, 130, 134, 137
openhands/sdk/event
   __init__.py50100% 
   base.py642560%34, 38, 49, 53–55, 57–62, 64–65, 67–69, 71–72, 74, 101–102, 124–125, 129
   condenser.py25772%26–27, 29, 33–35, 49
   llm_convertible.py881286%29–30, 35–36, 159–160, 165, 173, 184, 188–189, 194
   types.py30100% 
openhands/sdk/llm
   __init__.py50100% 
   exceptions.py361363%5–6, 9, 16, 23, 32, 47, 55, 72, 84, 91, 101, 108
   llm.py34111865%106–107, 110, 118, 120, 122, 126, 138, 147–148, 151–154, 156–157, 162–163, 166, 169–170, 174, 176, 181, 190, 222, 236–237, 240, 255, 269, 290, 297, 338, 350, 370, 380–381, 387, 401, 403, 406–409, 417, 421, 433, 437–439, 444–446, 448, 455–458, 461–465, 474–476, 505, 514, 518, 521–522, 525, 532, 569, 588–589, 594, 633, 643, 648–649, 680, 685, 689, 695–696, 700–701, 708, 710, 718, 726–733, 756, 760–761, 769–770, 786, 789–790, 797–801, 804, 809, 817, 819, 821
   llm_registry.py503138%39–42, 48–49, 53–56, 71–73, 77–79, 98, 103, 107, 112–113, 115–116, 118, 126, 134–138, 146
   message.py903462%22, 31, 35–37, 46–51, 73, 86, 102–103, 105, 107, 111–116, 118, 120–125, 127–129, 131
   metadata.py15473%17–18, 31, 33
openhands/sdk/llm/utils
   fn_call_converter.py34311466%74, 345, 348–349, 352, 368–369, 375, 382–383, 422, 424, 426, 428, 433–434, 442, 444, 448, 488, 518–520, 522, 524, 545–547, 553, 575, 593, 601–602, 610–613, 615, 617, 631–632, 637, 639, 643–644, 648, 656, 692, 701–704, 708–711, 727, 738, 748, 797–798, 800, 819–821, 823–826, 829, 833, 844–845, 859, 867, 870–871, 876, 905–908, 912–913, 918–919, 924, 944, 949, 973–974, 980, 994, 1006, 1008–1009, 1012–1014, 1016–1017, 1023–1025, 1027–1028, 1030, 1032, 1036, 1038, 1043, 1045–1046, 1049
   metrics.py1144560%75, 79–81, 85, 89, 93, 98, 103, 107–109, 113, 119, 131–134, 182, 185–186, 188, 190–191, 194, 200, 213–217, 221, 234, 237, 240–242, 246, 249, 254, 257–258, 260, 274, 277
   model_features.py35780%19–20, 22, 27, 43–44, 47
   retry_mixin.py503824%40, 42–43, 46–50, 53–59, 64, 85–86, 90, 92–95, 98–101, 104–105, 107–111, 114–116, 118
openhands/sdk/tool
   __init__.py30100% 
   schema.py712367%11–18, 24–26, 106–107, 109–110, 112–116, 119, 125, 142
   tool.py813359%16–17, 52, 98–100, 104, 120–122, 126, 136–137, 140, 143–146, 149–155, 160, 165–171
openhands/sdk/tool/builtins
   __init__.py30100% 
   finish.py14285%21, 40
openhands/sdk/utils
   json.py281257%15–21, 31, 45–48
openhands/tools
   __init__.py8275%37–38
openhands/tools/execute_bash
   __init__.py30100% 
   bash_session.py20312836%39, 66, 120–122, 129, 134, 141, 146–147, 174–176, 178–181, 189–190, 193, 198, 201–202, 204, 206, 212, 214–215, 217, 222, 227–230, 242–244, 247, 250–252, 258, 271–273, 276, 279–281, 288, 297, 318–319, 321, 324–328, 330, 333, 335–337, 341–342, 345–347, 351, 356–357, 361–362, 368–370, 378–379, 382–383, 385–387, 392, 404, 408, 411, 414–417, 423, 430–434, 440–442, 448–452, 455–458, 460–463, 470, 474, 485–487, 491, 495, 502–503, 506–508, 515–516
   constants.py90100% 
   definition.py391464%58, 62–71, 131, 134, 137
   impl.py9188%19
   metadata.py502354%67–73, 77–78, 83, 85, 87–96, 100–101
openhands/tools/execute_bash/utils
   command.py817211%15–19, 27, 32, 34–35, 37–38, 41–46, 48, 51–53, 55, 58–67, 74–75, 77–79, 81, 83, 90–91, 93, 95–97, 99, 101–102, 105–106, 109, 117, 120–121, 123–124, 127–129, 132–138, 141–145, 150
openhands/tools/str_replace_editor
   __init__.py30100% 
   definition.py34488%82, 149, 152, 155
   editor.py22817025%73, 75–76, 79, 98, 101, 110–114, 120–128, 130, 148–149, 169–170, 174, 178–179, 188, 192–195, 203–204, 208–210, 216, 219, 224, 227, 230–231, 234, 237–238, 242, 246, 260–262, 271, 274, 280, 285, 287–291, 293, 295, 299–300, 304–305, 313–314, 316–319, 321, 327–328, 334–336, 344–348, 352, 354–355, 362, 365, 370–371, 373, 396–397, 419–420, 422–423, 429, 432, 436–442, 445–446, 449–454, 457, 460–461, 465, 468–469, 472, 474–475, 481, 485, 503, 508–511, 513, 521, 528, 535, 546–549, 551, 553, 579–582, 591–592, 621–623, 625–634, 639–642, 655–656, 659, 664, 668, 674
   exceptions.py221340%5–6, 9, 16–18, 25–27, 38–41
   impl.py261157%31–32, 49–50, 52–54, 63–66
openhands/tools/str_replace_editor/utils
   __init__.py00100% 
   config.py20100% 
   encoding.py542750%42–43, 46–48, 51, 54, 60, 64–65, 67, 69, 78, 80–81, 84, 87–90, 93, 96–97, 114, 128, 130–131
   file_cache.py954849%43–46, 49–50, 54, 59, 61, 64, 69, 72–73, 87, 95–98, 108–112, 115–120, 126–130, 133–135, 138–140, 143–148, 151, 154
   history.py663645%58–60, 66–68, 70–71, 74–76, 78–79, 82, 85–86, 88, 92–94, 98–99, 102–104, 107, 111–113, 115–120, 122
   prompts.py40100% 
   shell.py241633%28, 30–32, 36, 38, 49–53, 60–61, 68–70
   truncate.py4175%13
openhands/tools/utils
   __init__.py00100% 
   security_prompt.py30100% 
TOTAL3378144657% 

@csmith49
csmith49 merged commit 19ea254 into main Sep 4, 2025
@csmith49
csmith49 deleted the fix/tests-and-serialization branch September 4, 2025 13:38
StressTestor pushed a commit to StressTestor/software-agent-sdk that referenced this pull request Jun 1, 2026
Co-authored-by: Calvin Smith <calvin@all-hands.dev>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant