Skip to content

cg api test-session

The test-session service endpoint. See cg api for how these relate to the higher-level commands.

Every command also accepts -h / --help.

Command Summary
cg api test-session TestSession service commands.
cg api test-session start-test-session Start (or resume) an interactive IDE test session for a puzzle.
cg api test-session play Run a codingamer's code against a single test case within a test session.
cg api test-session generate-lsp-token Generate a Language Server Protocol (LSP) auth token for a test session.
cg api test-session get-previous-code-by-language-id Fetch the codingamer's most recently saved code for one language in a test session.
cg api test-session submit Submit a final solution to a puzzle for credit.

cg api test-session

TestSession service commands.

usage: cg api test-session [-h] COMMAND ...

Subcommands

  • start-test-session — Start (or resume) an interactive IDE test session for a puzzle.
  • play — Run a codingamer's code against a single test case within a test session. Code is read from stdin.
  • generate-lsp-token — Generate a Language Server Protocol (LSP) auth token for a test session.
  • get-previous-code-by-language-id — Fetch the codingamer's most recently saved code for one language in a test session. CodinGame keeps your latest source per language, not just one; this reaches the ones the session isn't currently on. Prints JSON null if you've never attempted the puzzle in that language. This is a pure read--it does NOT make that language the session's current one (only running a test or submitting does that).
  • submit — Submit a final solution to a puzzle for credit. Code is read from stdin.

cg api test-session start-test-session

Start (or resume) an interactive IDE test session for a puzzle.

usage: cg api test-session start-test-session [-h] TEST-SESSION-HANDLE

Arguments

  • TEST-SESSION-HANDLE — The puzzle's test session handle (e.g. CgLastActivityPuzzle.test_session_handle).

cg api test-session play

Run a codingamer's code against a single test case within a test session. Code is read from stdin.

usage: cg api test-session play [-h] --language LANGUAGE-ID [--test-index N] TEST-SESSION-HANDLE

Arguments

  • TEST-SESSION-HANDLE — The puzzle's test session handle.

Options

  • -l, --language LANGUAGE-ID (required) — Programming language ID the code is written in, e.g. 'Python3'.
  • -t, --test-index N — 1-based test case index to run against, for MULTIPLE_LANGUAGES-type puzzles.

cg api test-session generate-lsp-token

Generate a Language Server Protocol (LSP) auth token for a test session.

usage: cg api test-session generate-lsp-token [-h] TEST-SESSION-ID

Arguments

  • TEST-SESSION-ID — The test session's numeric ID (CgTestSession.test_session_id).

cg api test-session get-previous-code-by-language-id

Fetch the codingamer's most recently saved code for one language in a test session. CodinGame keeps your latest source per language, not just one; this reaches the ones the session isn't currently on. Prints JSON null if you've never attempted the puzzle in that language. This is a pure read--it does NOT make that language the session's current one (only running a test or submitting does that).

usage: cg api test-session get-previous-code-by-language-id [-h] TEST-SESSION-HANDLE LANGUAGE-ID

Arguments

  • TEST-SESSION-HANDLE — The puzzle's test session handle.
  • LANGUAGE-ID — CodinGame language ID, e.g. 'Python3', 'C++'.

cg api test-session submit

Submit a final solution to a puzzle for credit. Code is read from stdin.

usage: cg api test-session submit [-h] --language LANGUAGE-ID TEST-SESSION-HANDLE

Arguments

  • TEST-SESSION-HANDLE — The puzzle's test session handle.

Options

  • -l, --language LANGUAGE-ID (required) — Programming language ID the code is written in, e.g. 'Python3'.

Generated from the parser itself. For when to use these, see the CLI guides.