Skip to content

Re-enable IDT complexity score tests on Windows (fixes #221) - #370

Open
anshuman83-40 wants to merge 2 commits into
SynBioDex:developfrom
anshuman83-40:fix-221-windows-complexity-tests
Open

anshuman83-40 wants to merge 2 commits into
SynBioDex:developfrom
anshuman83-40:fix-221-windows-complexity-tests

Conversation

@anshuman83-40

@anshuman83-40 anshuman83-40 commented Oct 3, 2026 •

Copy link
Copy Markdown

Root cause

The Windows failures in #221 were caused by CI, not by the library. When the
tests ran on windows-latest, the step

echo "$IDT_CREDENTIALS" > test_secret_idt_credentials.json

ran under PowerShell, the default shell on Windows runners. In PowerShell,
$IDT_CREDENTIALS is a PowerShell variable (undefined, so empty), not the
environment variable ($env:IDT_CREDENTIALS). The credentials file therefore
held only a newline. Reading it in text mode gives exactly the reported error:

json.decoder.JSONDecodeError: Expecting value: line 2 column 1 (char 1)

(Reproduced locally: a file containing only \r\n, opened in text mode, raises this exact error.)

Change

  • Removed the two skipIf(sys.platform == 'win32') decorators.
  • Added a class-level skipUnless(CREDENTIALS_FILE.exists()). Contributors without IDT
    credentials now see the tests skipped instead of a FileNotFoundError, on every platform.

Testing

  • On Windows 11 / Python 3.13 with the IDT HTTP calls mocked (post patched to return
    the scores stored in Comparison_file_Complexity_Scores.nt), both
    test_IDT_calculate_complexity_score and test_commandline pass.
  • Without a credentials file, both tests are reported as skipped.
  • I don't have IDT credentials, so I couldn't run against the live API on Windows.

Note: the external-api-tests job now runs only on ubuntu-latest (where the default shell is
bash), so CI is not affected. If Windows is ever added to that job, the credentials step should
use shell: bash.

The Windows failures in SynBioDex#221 were not a library bug: the CI step
`echo "$IDT_CREDENTIALS" > test_secret_idt_credentials.json` ran under
PowerShell on windows-latest, where `$IDT_CREDENTIALS` is an (empty)
PowerShell variable rather than the environment variable. The credentials
file therefore contained only a newline, producing
"JSONDecodeError: Expecting value: line 2 column 1 (char 1)".

Remove the win32 skips and instead skip the test class when the
credentials file is absent, so local runs without IDT access skip
cleanly on every platform.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@anshuman83-40
anshuman83-40 changed the base branch from main to develop October 3, 2026 06:30

@jakebeal jakebeal left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice job diagnosing the problem! So far as I can tell, however, this does not actually fix the problem, it only shuts off the tests for a more principled reason. Can you find a way to allow the credentials file to actually be created?

Address review on SynBioDex#370: rather than only skipping the tests, make CI
actually create the credentials file on Windows.

- Run the credentials/test step with `shell: bash`, so `$IDT_CREDENTIALS`
  expands to the environment variable instead of an empty PowerShell
  variable on windows-latest (the root cause of SynBioDex#221).
- Run external-api-tests on ubuntu, windows and macOS, with
  `max-parallel: 1` so the IDT service is never hit concurrently (SynBioDex#368).
- Skip the tests when the credentials file is empty as well as missing,
  since secrets are not passed to pull requests from forks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@anshuman83-40

Copy link
Copy Markdown
Author

Thanks! Good point. I've updated the workflow so the credentials file is actually created on every platform: the step now runs with shell: bash (so $IDT_CREDENTIALS expands on Windows), and external-api-tests runs on ubuntu/windows/macos with max-parallel: 1 to avoid concurrent IDT calls (#368). The tests also skip if the file is empty, since secrets aren't available to fork PRs, so this needs a run from a maintainer branch to fully exercise.

This branch has not been deployed

No deployments
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.

2 participants