Closed matthewfeickert closed 3 years ago
Hello @matthewfeickert! Just noticed that I answer you only in my mind (sorry about that). Would this help you https://github.com/anapaulagomes/pytest-picked/pull/113? I'll be releasing a new version in the next days.
Would this help you #113?
From taking a brief look at it I think it will. Thanks @pschroeder89!
I'll be releasing a new version in the next days.
Okay great. I'm watching the releases on GitHub, but if you can ping here when it is up on PyPI I'll check my use case and see if that resolves this Issue.
Hello @matthewfeickert and @pschroeder89, I just release a test version on TestPypi. Would you be kind enough to test it locally? Many thanks. pip install -i https://test.pypi.org/simple/ pytest-picked
Thanks @anapaulagomes, I just tested locally and it's working:
pytest --picked --mode=branch --parent-branch=main
pytest --picked --mode=branch --parent-branch=master --collect-only
collected 51 items / 4 deselected / 47 selected
pytest --picked --mode=branch --parent-branch=main --collect-only
collected 51 items / 8 deselected / 43 selected
Thanks!
Thank you, @pschroeder89! I'll publish it on Pypi.
@anapaulagomes Sorry for not getting back in a timeline manner, but having had time to test PR #113 in the new release it doesn't address the use case of my Issue actually. Can we please reopen this Issue?
In the following GHA workflow
on:
push:
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
python -m pip install --ignore-installed -U -q --no-cache-dir -e .
python -m pip list
- name: Test with pytest
run: |
python -m pytest -r sx --picked=first --mode=branch --parent-branch=remotes/origin/master
this fails with
ERROR: usage: __main__.py [options] [file_or_dir] [file_or_dir] [...]
__main__.py: error: unrecognized arguments: --parent-branch=remotes/origin/master
inifile: /home/runner/work/pyhf/pyhf/pyproject.toml
rootdir: /home/runner/work/pyhf/pyhf
When given the git diff
command being run here
I was expecting it to have found
$ git diff --name-status --relative remotes/origin/master
M .github/workflows/ci.yml
M setup.py
I'll note that
python -m pytest -r sx --picked=first --mode=branch --collect-only
runs correctly as expected.
@pschroeder89 as the PR author do you have thoughts on what might be happenng here?
Hey @matthewfeickert, thanks for looking into it. Did you test it using the Test PyPi package? This should be the one (the automation for publishing the package to Pypi failed yesterday and I'll look into it today). I'll reopen the issue anyways.
Now the plugin is available on Pypi too, @matthewfeickert.
Did you test it using the Test PyPi package? This should be the one (the automation for publishing the package to Pypi failed yesterday and I'll look into it today). I'll reopen the issue anyways.
No, sorry, I was using PyPI. It was late when I was testing this and so I was a bit lazy and didn't check to make sure that the version I got with python -m pip install --upgrade pytest-picked
was in fact v0.4.6
(I just saw that it had downloaded a new release from PyPI).
Now the plugin is available on Pypi too.
Indeed! :) I can confirm that v0.4.6
is exhibiting the behavior I wanted, so I'll go ahead and close this now.
Thank you very much for adding this in your PR @pschroeder89 and thank you very much for developing this library @anapaulagomes. Happy holidays!
Awesome! Happy holidays to you guys too! @matthewfeickert @pschroeder89 🍻
Hi. It seems that at the moment this (very cool!) project isn't usable when run with
--mode=branch
using GitHub Actionscheckout
action (the start of pretty much every GHA workflow). If I attempt to use the something like the followingI'll get
in the printed
pytest
logs. This is because thecheckout
action will checkout the current branch and then put the project underremotes/origin/
. So adding inwould show something like
Would it be possible to look for some pattern that could match this if
master
isn't detected? Or allow for a branch name to given as an argument to test relative to?