SKY-A113 · AI-code defects
Tests fail when Skylos runs them
Skylos runs the project's tests itself and reports each test that fails. What a coding agent says about its own test run is ignored: only the results Skylos reads from its own run count.
- Languages
- Python (pytest, found automatically), any test command that writes JUnit XML (set test_command and junit_xml)
- Turned on by
skylos done(compares uncommitted changes withHEAD) orskylos done --base origin/mainfor a pull request; agent hooks run it when the agent stops- Quality gate
- not checked (full and diff scans). Only
skylos donereports it, in itstests_passcheck, which blocks by default: one failing test fails the verdict, and a run that cannot finish leaves it unfinished. A flaky test (failed once, passed on a rerun) is advice. Failures that also fail on the base commit still block unless the base setsallow_preexisting_failures = true. - Finding type
- defect
Why it matters
Agents often report "all tests pass" after running only some tests, an old command, or nothing at all. A change that breaks a test should not be called finished, and a reviewer should not have to rerun the suite to find out.
What Skylos flags
import re def slugify(title):Removed: slug = re.sub(r"[^a-z0-9]+", "-", title.lower())Added: slug = re.sub(r"\s+", "-", title.lower()) return slug.strip("-")2 committed files the change leaves alone
[project]name = "blog"version = "1.2.0" [tool.pytest.ini_options]testpaths = ["tests"]import pytest from blog.slug import slugify def test_spaces_become_dashes(): assert slugify("Hello World") == "hello-world" def test_punctuation_is_dropped(): assert slugify("Rock & Roll!") == "rock-roll" @pytest.mark.xfail(reason="accents are dropped, issue 212")def test_accents_are_kept(): assert slugify("Café Crème") == "cafe-creme"What Skylos leaves alone
import re Removed: def slugify(title):Added: def slugify(title, max_length=80): slug = re.sub(r"[^a-z0-9]+", "-", title.lower())Removed: return slug.strip("-")Added: return slug.strip("-")[:max_length].rstrip("-")2 committed files the change leaves alone
Why Skylos leaves it alone
test_accents_are_kept still fails, but it is marked xfail: an expected failure that pytest reports as such, not as a failed test. The other two tests pass, so the run passes.
How Skylos decides
- Runs in
skylos done, last among its checks, and only when no earlier blocking check failed. With--no-testsit does not run, and a blocking check that did not run leaves the verdict unfinished. - Chooses the command:
test_commandfrom[tool.skylos.done]at the base, elsepython -m pytestwhen the project looks like a pytest project, using the active virtualenv, the repository's.venvorvenv, or apython3onPATHthat has pytest. - For pytest, adds its own
--junitxmland dropsPYTEST_ADDOPTSandPYTEST_PLUGINSfrom the environment, so neither the change nor the caller can narrow the run. Another command must write JUnit XML to thejunit_xmlpath; an exit code alone is not accepted. - Reads the JUnit results. A failing test is rerun once: failing twice is a blocking finding, passing on the rerun is flaky advice. Failing tests are also rerun on the base commit to label each failure as introduced or already there.
- Also reports a test in a changed test file that did not report a result although its file ran, a test file with no results, and parametrized tests that reported fewer cases than they have. A run past
test_budget_seconds(300 by default) or with no results is unfinished, never passing.
How to fix it
Fix the code until the failing test passes; here, keep dropping punctuation. Run skylos done again to get a passing receipt. If the test is wrong, change the test in the same change and say why.
def slugify(title): slug = re.sub(r"[^a-z0-9]+", "-", title.lower()) return slug.strip("-")When it can be wrong
- A test that fails only on this machine (a missing service, a missing dependency in the chosen interpreter) is reported like any failure. Set
test_commandto the command your project really uses. - A test that already failed before the change still blocks by default; the finding says it also fails on the base.
- JavaScript and other tests run only through
test_commandwithjunit_xml; without them, a JavaScript-only project's tests are not run.
Seeing a case that isn't listed here? Report the wrong result so the rule can be fixed. Don't paste company code: describe the shape of it.
How to silence it
skylos donefindings ignore# skylos: ignore[...]comments and the[tool.skylos] ignorelist. To accept failures that also fail on the base, commit this to the base branch first (the change under review cannot change its own check):TOML [tool.skylos.done]allow_preexisting_failures = true