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

pytest watch seems to fail when pyproject.toml is used as a config file #114

Open
max-sixty opened this issue Aug 14, 2020 · 7 comments
Open

Comments

@max-sixty
Copy link

When pytest config is stored in pyproject.toml:

Traceback (most recent call last):
  File "/Users/maximilian/Library/Caches/pypoetry/virtualenvs/n-cyukv0jK-py3.8/bin/ptw", line 8, in <module>
    sys.exit(main())
  File "/Users/maximilian/Library/Caches/pypoetry/virtualenvs/n-cyukv0jK-py3.8/lib/python3.8/site-packages/pytest_watch/command.py", line 83, in main
    if not merge_config(args, pytest_args, verbose=args['--verbose']):
  File "/Users/maximilian/Library/Caches/pypoetry/virtualenvs/n-cyukv0jK-py3.8/lib/python3.8/site-packages/pytest_watch/config.py", line 95, in merge_config
    config.read(config_path)
  File "/usr/local/Cellar/python@3.8/3.8.5/Frameworks/Python.framework/Versions/3.8/lib/python3.8/configparser.py", line 697, in read
    self._read(fp, filename)
  File "/usr/local/Cellar/python@3.8/3.8.5/Frameworks/Python.framework/Versions/3.8/lib/python3.8/configparser.py", line 1113, in _read
    raise e
configparser.ParsingError: Source contains parsing errors: '/Users/maximilian/workspace/n/pyproject.toml'
	[line 59]: ']\n'

This works when the pytest config in pyproject.toml is removed

@Kreeg
Copy link

Kreeg commented Jul 6, 2022

any updates?

@satheler
Copy link

satheler commented Aug 1, 2022

Same problem here.

@Jufik
Copy link

Jufik commented Aug 11, 2022

Faced the same issue and investigated my pyproject.toml

anytime you have

variable=[
    ....
]

I change to (note the 4 spaces)

variable=[
    ....
    ]

PTW works like a charm

@abdul-hamid-achik
Copy link

folks how can one simple mortal format a file in a way where this does not happen but you keep your pytest config on your pyproject.toml?

@abdul-hamid-achik
Copy link

btw moving pytest configuration form pyproject.toml to pytest.ini did the trick but I would prefer to not have extra config files

@ketozhang
Copy link

ketozhang commented May 2, 2023

As we can see in the trace, this tool only implements parsing using the configparser — it assumes pytest config are only ini files. What I see the next steps are for pytest-watch to stop bootstrapping off of pytest.config and start handling their own parsing of pytest.ini, pyproject.toml, and any legacy config files.

@joeyespo Any interest of accepting contributions to this?

@olzhasar
Copy link

For anyone who is looking for a working and maintained alternative to pytest-watch:
https://github.com/olzhasar/pytest-watcher

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

No branches or pull requests

7 participants