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

Features from newer python versions cause syntax errors #21

Open
asfaltboy opened this issue Mar 26, 2018 · 5 comments
Open

Features from newer python versions cause syntax errors #21

asfaltboy opened this issue Mar 26, 2018 · 5 comments
Labels
bug critical Bugs that require immediate attention

Comments

@asfaltboy
Copy link
Owner

For example using f-strings in tests (a python 3.6 feature), causes a SyntaxError when passing the test module so urce to ast.parse() using the builtin python3.3/ast.py. Full traceback below:

Traceback (most recent call last):
  File "/Applications/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 795, in run_
    return self.run(**args)
  File "/Users/pavel.savchenko/Library/Application Support/Sublime Text 3/Packages/SublimeTestPlier/python_test_plier.py", line 102, in run
    self.get_pattern(view)
  File "/Users/pavel.savchenko/Library/Application Support/Sublime Text 3/Packages/SublimeTestPlier/python_test_plier.py", line 73, in get_pattern
    pattern = view and utils.get_test(view)
  File "/Users/pavel.savchenko/Library/Application Support/Sublime Text 3/Packages/SublimeTestPlier/utils/__init__.py", line 83, in get_test
    class_name, method_name = parser.parse(line)
  File "/Users/pavel.savchenko/Library/Application Support/Sublime Text 3/Packages/SublimeTestPlier/test_parser.py", line 89, in parse
    tree = ast.parse(self.source)
  File "./python3.3/ast.py", line 35, in parse
  File "<unknown>", line 59
    print(f'some {kind} of test')
                               ^
SyntaxError: invalid syntax
@asfaltboy asfaltboy added bug critical Bugs that require immediate attention labels Mar 26, 2018
@dc-avasilev
Copy link

dc-avasilev commented Aug 6, 2019

same here, it's because f-string
parser work on python3.3 -> need to be upgrade to 3.6 minimal

@asfaltboy
Copy link
Owner Author

Ooops, my bad! I forgot that I added support for pluggable python version a while back, and didn't update the docs.

Check out the PR here and let me know if it's sufficiently clarifying.

tl;dr sublime ships with 3.3. specify a path to python with desired version in your build system via:

"python_executable": "/usr/local/opt/python/bin/python3.7",

@dc-avasilev
Copy link

Ooops, my bad! I forgot that I added support for pluggable python version a while back, and didn't update the docs.

Check out the PR here and let me know if it's sufficiently clarifying.

tl;dr sublime ships with 3.3. specify a path to python with desired version in your build system via:

"python_executable": "/usr/local/opt/python/bin/python3.7",

it's not help

{
    "build_systems":
    [
        {
            "python_executable": "/Users/user/path/automation-services/.venv/bin/python3",
            "cmd": [
                "/Users/user/path/automation-services/.venv/bin/pytest",
                "{filename}::{test_func}",
                "-k {selection}"
            ],
            "name": "Pytest Runner",
            "target": "run_python_tests",
            "working_dir": "/Users/user/path/automation-services",
            "external": true  // with this and without
        }
    ]
}

i still have error f-string

@asfaltboy
Copy link
Owner Author

asfaltboy commented Aug 8, 2019

What version is /Users/user/path/automation-services/.venv/bin/python3 run python3 -V ?

If running this "Pytest Runner" build fails it should throw an exception in the console, can you show me the full traceback?

@asfaltboy
Copy link
Owner Author

asfaltboy commented Aug 10, 2019

@dc-avasilev have you had any chance to look into the logs?
You could also try to enable SublimeTestPlier's verbose logging by adding "debug": true to your SublimeTestPlier.sublime-settings file. This will output your kwargs, as well as many of the calls in the test resolution flow.

For more information on editing user settings, see here:
https://www.sublimetext.com/docs/3/settings.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug critical Bugs that require immediate attention
Projects
None yet
Development

No branches or pull requests

2 participants