Skip to content

Commit 63f83d9

Browse files
authored
Chore: Switch to Hatch (#307)
1 parent 47f4ef3 commit 63f83d9

16 files changed

+278
-1378
lines changed

.github/workflows/nightly.yml

-10
This file was deleted.

.github/workflows/publish.yml

+16-25
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,31 @@
1-
name: publish
1+
name: Publish
22

33
on:
44
push:
55
tags:
6-
- v*
6+
- "[0-9]+.[0-9]+.[0-9]+"
7+
- "[0-9]+.[0-9]+.[0-9]+rc[0-9]+"
78

89
jobs:
910
publish:
11+
if: github.repository == 'pytest-dev/pytest-selenium'
1012
runs-on: ubuntu-latest
1113
steps:
1214
- uses: actions/checkout@v3
13-
14-
- name: Set up Python
15-
uses: actions/setup-python@v3
1615
with:
17-
python-version: "3.9"
18-
19-
- name: Install poetry
20-
run: curl -sSL https://install.python-poetry.org | python3 -
16+
fetch-depth: 0
17+
persist-credentials: false
2118

22-
- name: Configure poetry
23-
run: poetry config virtualenvs.in-project true
19+
- name: Build and Check Package
20+
uses: hynek/build-and-inspect-python-package@v1
2421

25-
- name: Set up cache
26-
uses: actions/cache@v3
22+
- name: Download Package
23+
uses: actions/download-artifact@v3
2724
with:
28-
path: .venv
29-
key: venv-${{ hashFiles('**/poetry.lock') }}
30-
restore-keys: venv-
25+
name: Packages
26+
path: dist
3127

32-
- name: Install Dependencies
33-
run: poetry install
34-
35-
- name: Publish
36-
run: >-
37-
poetry publish
38-
--build
39-
--username __token__
40-
--password ${{ secrets.PYPI_TOKEN }}
28+
- name: Publish package to PyPI
29+
uses: pypa/gh-action-pypi-publish@release/v1
30+
with:
31+
password: ${{ secrets.PYPI_TOKEN }}

.github/workflows/test.yml

+121-72
Original file line numberDiff line numberDiff line change
@@ -1,97 +1,146 @@
1-
name: test
1+
name: Tests
22

33
on:
44
push:
55
branches:
66
- master
7-
tags-ignore:
8-
- v*
7+
8+
schedule:
9+
- cron: '0 18 * * *' # Run daily at 14:00 UTC
10+
911
pull_request:
10-
workflow_call:
12+
13+
concurrency:
14+
group: ${{ github.workflow }}-${{ github.ref }}
15+
cancel-in-progress: ${{ ! contains(github.ref, github.event.repository.default_branch) }}
1116

1217
env:
1318
PYTEST_ADDOPTS: "-m 'not (edge or safari)'"
1419

1520
jobs:
21+
linting:
22+
runs-on: ubuntu-latest
23+
steps:
24+
- uses: actions/checkout@v3
25+
26+
- name: Set up Python
27+
uses: actions/setup-python@v4
28+
with:
29+
python-version: "3.10"
30+
31+
- name: Install dependencies
32+
run: |
33+
python -m pip install --upgrade pip
34+
pip install tox
35+
36+
- name: Run tests
37+
run: tox -e linting
38+
1639
test:
40+
name: ${{ matrix.os }} - ${{ matrix.python-version }}
1741
runs-on: ${{ matrix.os }}
1842
strategy:
19-
fail-fast: false
43+
fail-fast: true
2044
matrix:
21-
python: ["3.7", "3.8", "3.9", "3.10", "pypy-3.8"]
2245
os: [ubuntu-latest, windows-latest]
46+
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
2347
include:
24-
- python: "3.7"
25-
tox_env: "py37"
26-
- python: "3.8"
27-
tox_env: "py38"
28-
- python: "3.9"
29-
tox_env: "py39"
30-
- python: "3.10"
31-
tox_env: "py310"
32-
- python: "pypy-3.8"
33-
tox_env: "pypy3"
48+
- os: ubuntu-latest
49+
python-version: pypy3.9
50+
tox-env: py3.9
51+
- os: windows-latest
52+
python-version: pypy3.9
53+
tox-env: py3.9
54+
55+
# TODO(jim) Deactivate devel tests pending troubleshooting
56+
# - os: ubuntu-latest
57+
# python-version: 3.12-dev
58+
# tox-env: devel
59+
# - os: windows-latest
60+
# python-version: 3.12-dev
61+
# tox-env: devel
62+
3463
steps:
35-
- uses: actions/checkout@v3
36-
37-
- name: Set up Python
38-
uses: actions/setup-python@v3
39-
with:
40-
python-version: ${{ matrix.python }}
41-
42-
- name: Install tox
43-
run: |
44-
python -m pip install --upgrade pip
45-
pip install tox
46-
47-
- name: Setup Firefox
48-
if: matrix.os == 'ubuntu-latest'
49-
uses: browser-actions/setup-firefox@latest
50-
with:
51-
firefox-version: latest
52-
53-
- name: Setup Geckodriver
54-
if: matrix.os == 'ubuntu-latest'
55-
uses: browser-actions/setup-geckodriver@latest
56-
57-
- name: Setup Chrome
58-
uses: browser-actions/setup-chrome@latest
59-
with:
60-
chrome-version: stable
61-
62-
- name: Setup Chromedriver
63-
uses: nanasess/setup-chromedriver@master
64-
65-
- name: Cache tox environments
66-
uses: actions/cache@v3
67-
with:
68-
path: .tox
69-
key: tox-${{ matrix.os }}-${{ matrix.python }}-${{ hashFiles('pyproject.toml', 'poetry.lock') }}
70-
71-
- name: Test
72-
if: matrix.os == 'ubuntu-latest'
73-
run: tox -e ${{ matrix.tox_env }}
74-
75-
- name: Test (skip firefox on windows)
76-
if: matrix.os == 'windows-latest'
77-
env:
78-
PYTEST_ADDOPTS: "-m 'not (edge or safari or firefox)'"
79-
run: tox -e ${{ matrix.tox_env }}
64+
- uses: actions/checkout@v3
65+
66+
- name: Set up python
67+
uses: actions/setup-python@v4
68+
with:
69+
python-version: ${{ matrix.python-version }}
70+
71+
- name: Install tox
72+
run: |
73+
python -m pip install --upgrade pip
74+
pip install tox
75+
76+
- name: Setup Firefox
77+
if: matrix.os == 'ubuntu-latest'
78+
uses: browser-actions/setup-firefox@latest
79+
with:
80+
firefox-version: latest
81+
82+
- name: Setup Geckodriver
83+
if: matrix.os == 'ubuntu-latest'
84+
uses: browser-actions/setup-geckodriver@latest
85+
86+
- name: Setup Chrome
87+
uses: browser-actions/setup-chrome@latest
88+
with:
89+
chrome-version: stable
90+
91+
- name: Setup Chromedriver
92+
uses: nanasess/setup-chromedriver@master
93+
94+
- name: Cache tox environments
95+
uses: actions/cache@v3
96+
with:
97+
path: .tox
98+
key: tox-ubuntu-latest-${{ matrix.python-version }}-${{ hashFiles('pyproject.toml', 'tox.ini') }}
99+
restore-keys: |
100+
tox-ubuntu-latest-${{ matrix.python-version }}-
101+
102+
- name: Set tox variable
103+
shell: bash
104+
run: |
105+
echo "python-version: ${{ matrix.python-version }}"
106+
echo "tox-env: ${{ matrix.tox-env }}"
107+
if [[ -n "${{ matrix.tox-env }}" ]]; then
108+
echo "tox=${{ matrix.tox-env }}" >> "$GITHUB_ENV"
109+
else
110+
echo "tox=py${{ matrix.python-version }}" >> "$GITHUB_ENV"
111+
fi
112+
113+
- name: Test
114+
if: matrix.os == 'ubuntu-latest'
115+
run: tox -e "${{ env.tox }}"
116+
117+
- name: Test (skip firefox on windows)
118+
if: matrix.os == 'windows-latest'
119+
env:
120+
PYTEST_ADDOPTS: "-m 'not (edge or safari or firefox)'"
121+
run: tox -e "${{ env.tox }}"
122+
123+
- name: Archive report.html
124+
if: failure()
125+
uses: actions/upload-artifact@v1
126+
with:
127+
name: report.html.${{ matrix.os }}-${{ env.tox }}.zip
128+
path: .tox/${{ env.tox }}/log/report.html
80129

81130
docs:
82131
runs-on: ubuntu-latest
83132
steps:
84-
- uses: actions/checkout@v3
133+
- uses: actions/checkout@v3
85134

86-
- name: Set up Python
87-
uses: actions/setup-python@v3
88-
with:
89-
python-version: 3.9
135+
- name: Set up Python
136+
uses: actions/setup-python@v4
137+
with:
138+
python-version: "3.10"
90139

91-
- name: Install dependencies
92-
run: |
93-
python -m pip install --upgrade pip
94-
pip install tox
140+
- name: Install dependencies
141+
run: |
142+
python -m pip install --upgrade pip
143+
pip install tox
95144
96-
- name: Run tests
97-
run: "tox -e docs"
145+
- name: Run tests
146+
run: tox -e docs

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
__pycache__
2+
__version.py
23
.cache
34
.DS_Store
45
.eggs

README.rst

+1-4
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,11 @@ support for running `Selenium <http://seleniumhq.org/>`_ based tests.
1010
.. image:: https://img.shields.io/pypi/v/pytest-selenium.svg
1111
:target: https://pypi.python.org/pypi/pytest-selenium/
1212
:alt: PyPI
13-
.. image:: https://img.shields.io/travis/pytest-dev/pytest-selenium.svg
14-
:target: https://travis-ci.org/pytest-dev/pytest-selenium/
15-
:alt: Travis
1613
.. image:: https://img.shields.io/badge/docs-latest-brightgreen.svg
1714
:target: http://pytest-selenium.readthedocs.io/en/latest/
1815
:alt: Read the Docs
1916
.. image:: https://img.shields.io/badge/code%20style-black-000000.svg
20-
:target: https://github.com/ambv/black
17+
:target: https://github.com/ambv/black
2118
.. image:: https://img.shields.io/github/issues-raw/pytest-dev/pytest-selenium.svg
2219
:target: https://github.com/pytest-dev/pytest-selenium/issues
2320
:alt: Issues

docs/development.rst

+10-20
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
11
Development
22
===========
33

4-
To contribute to `pytest-selenium` you can use `Pipenv`_ to manage
4+
To contribute to `pytest-selenium` you can use `Hatch`_ to manage
55
a python virtual environment and `pre-commit <https://pre-commit.com/>`_ to help you with
66
styling and formatting.
77

88
To setup the virtual environment and pre-commit, run:
99

1010
.. code-block:: bash
1111
12-
$ pipenv install --dev
13-
$ pipenv run pre-commit install
12+
$ hatch -e test run pre-commit install
1413
15-
If you're not using `Pipenv`_, to install `pre-commit`, run:
14+
If you're not using `Hatch`_, to install `pre-commit`, run:
1615

1716
.. code-block:: bash
1817
@@ -23,30 +22,21 @@ If you're not using `Pipenv`_, to install `pre-commit`, run:
2322
Automated Testing
2423
-----------------
2524

26-
All pull requests and merges are tested in `Travis CI <https://travis-ci.org/>`_
27-
based on the ``.travis.yml`` file.
28-
29-
Usually, a link to your specific travis build appears in pull requests, but if
30-
not, you can find it on the
31-
`pull requests page <https://travis-ci.org/pytest-dev/pytest-selenium/pull_requests>`_
32-
33-
The only way to trigger Travis CI to run again for a pull request, is to submit
34-
another change to the pull branch.
35-
36-
You can do this with `git commit --allow-empty`
25+
All pull requests and merges are tested in `GitHub Actions <https://docs.github.com/en/actions>`_
26+
based on the workflows defined in ``.github/workflows``.
3727

3828
Running Tests
3929
-------------
4030

4131
You will need `Tox <http://tox.testrun.org/>`_ installed to run the tests
42-
against the supported Python versions. If you're using `Pipenv`_ it will be
32+
against the supported Python versions. If you're using `Hatch`_ it will be
4333
installed for you.
4434

45-
With `Pipenv`_, run:
35+
With `Hatch`_, run:
4636

4737
.. code-block:: bash
4838
49-
$ pipenv run tox
39+
$ hatch -e test run tox
5040
5141
Otherwise, to install and run, do:
5242

@@ -101,8 +91,8 @@ Follow these steps to release a new version of the project:
10191
3. Commit and push the new branch and then create a new pull request
10292
4. Wait for tests and reviews and then merge the branch
10393
5. Once merged, update your local master again (``git pull --rebase upstream master``)
104-
6. Tag the release with the new release version (``git tag v<new tag>``)
94+
6. Tag the release with the new release version (``git tag <new tag>``)
10595
7. Push the tag (``git push upstream --tags``)
10696
8. Done. You can monitor the progress on `Travis <https://travis-ci.org/pytest-dev/pytest-selenium/>`_
10797

108-
.. _Pipenv: https://docs.pipenv.org/en/latest/
98+
.. _Hatch: https://hatch.pypa.io/latest/

docs/installing.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Installation
44
Requirements
55
------------
66

7-
pytest-selenium will work with Python >=3.6.
7+
pytest-selenium will work with Python >=3.7.
88

99
Install pytest-selenium
1010
-----------------------

0 commit comments

Comments
 (0)