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

SyntaxError: invalid syntax on pytest --snapshot-update #844

Open
alexjolig opened this issue Jan 29, 2024 · 1 comment
Open

SyntaxError: invalid syntax on pytest --snapshot-update #844

alexjolig opened this issue Jan 29, 2024 · 1 comment

Comments

@alexjolig
Copy link

I just installed syrupy and tried pytest --snapshot-update to produce the snapshots. at the first test including the snapshot fixture, I have this line:
base_url = "some-url"
and I get this error:

E       pytest --snapshot-update    base_url = "some-url"
E                                   ^
E   SyntaxError: invalid syntax

How to reproduce?

Add this test:

def test_get_current_user(get_headers, snapshot):
    base_url = "some-url"
    response = requests.get(
        f"https://{base_url}/api/account_manager/user/me",
        headers={**get_headers, "Content-Type": "application/json"},
    )
    result = response.json()
    assert response.status_code == 200
    assert result == snapshot

run:
pytest --snapshot-update

Environment:

  • OS: Ubuntu
  • Syrupy Version: 4.6.0
  • Python Version: 3.9
@noahnu
Copy link
Collaborator

noahnu commented Feb 3, 2024

I don't think this is related to syrupy. This looks like you probably have a mismatched whitespace causing a syntax error. If you can create a GitHub repo that reproduces the error outside of your local environment, I can take a look. As it stands, I can't reproduce this from the snippet you shared.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants