Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add testScript python injection #55

Conversation

nekowinston
Copy link

Matches against both of:

{
  testScript = ''
    import numpy as np
    assert str(np.zeros(4) == "array([0., 0., 0., 0.])") 
  '';
  testScript = {...}: ''
    import numpy as np
    assert str(np.zeros(4) == "array([0., 0., 0., 0.])") 
  '';
}

Closes #54

@adisbladis
Copy link
Member

adisbladis commented Aug 2, 2024

This solution feels a bit ad-hoc and hacky.

For some historical context:
NixOS tests weren't always Python. A few years ago they were in Perl, and that may change again at some point, though hopefully not.

testScript is also a fairly generic name that we don't always want to interpret as Python.
I think we're probably gonna have to go with a special format comment to hint to the parser which language multi-line strings are actually in.
This touches on much more than just tree-sitter-nix.

@nekowinston nekowinston closed this Aug 2, 2024
@nekowinston nekowinston deleted the feat/add-testscript-python-injection branch August 2, 2024 03:25
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.

Python injection is missing for testScript
2 participants