Skip to content

Commit

Permalink
Make main the default branch (#175)
Browse files Browse the repository at this point in the history
* Make main the default branch

* Configure main as the main branch in the CI

* Rename branch to main

* Rename master branch to main in the CI

* Remove mentions to master

* Fetch main

* Put lines back

* Assert if command has successfuly ran

* Remove echos from test workflow
  • Loading branch information
anapaulagomes authored Jul 27, 2023
1 parent d203ddb commit 78c0a25
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 13 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,6 @@ jobs:
python -m pip install -r requirements.txt
python setup.py install
- name: Run tests for ${{ matrix.python-version }}
run: pytest -vvv
run: |
git branch -m main # still master by default in GitHub Actions
pytest -vvv
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## [Unreleased]
### Added
- Make `main` the default parent branch (#148)
- Drop support to Python 3.5 and 3.6, and add support to 3.9, 3.10, and 3.11

## [0.4.6] - 2020-12-17
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ Let's say you have the following output from `git status`:

$ git status

On branch master
Your branch is ahead of 'origin/master' by 1 commit.
On branch main
Your branch is ahead of 'origin/main' by 1 commit.
(use "git push" to publish your local commits)

Untracked files:
Expand Down Expand Up @@ -65,7 +65,7 @@ pytest --picked --mode=branch

pytest --picked --mode=unstaged # default

pytest --picked --mode=branch --parent-branch=main # if your parent branch differs from "master"
pytest --picked --mode=branch --parent-branch=dev # if your parent branch differs from "main"
```

## Features
Expand Down
4 changes: 3 additions & 1 deletion pytest_picked/modes.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import re
import subprocess # nosec
import warnings
from abc import ABC, abstractmethod


Expand Down Expand Up @@ -49,8 +50,9 @@ def parser(self, candidate):


class Branch(Mode):
def __init__(self, test_file_convention, parent_branch="master"):
def __init__(self, test_file_convention, parent_branch="main"):
super().__init__(test_file_convention)
warnings.warn("Now `main` is the default parent branch")
self.parent_branch = parent_branch

def command(self):
Expand Down
4 changes: 2 additions & 2 deletions pytest_picked/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ def pytest_addoption(parser):
"--parent-branch",
action="store",
dest="parent_branch",
default="master",
default="main",
required=False,
help="The main branch of your repo (master, main, trunk, etc)",
help="The main branch of your repo (main, develop, trunk etc)",
)


Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def read(fname):

setup(
name="pytest-picked",
version="0.4.7",
version="0.5.0",
author="Ana Paula Gomes",
author_email="apgomes88@gmail.com",
maintainer="Ana Paula Gomes",
Expand Down
6 changes: 2 additions & 4 deletions tests/test_modes.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@ def git_repository(testdir):
assert testdir.run(*git_user).ret == 0
assert testdir.run(*git_email).ret == 0

testdir.run(
"git", "checkout", "-b", "master"
).ret # TODO remove when making main the default branch
assert testdir.run("git", "checkout", "-b", "main").ret == 0
assert testdir.run("git", "commit", "--allow-empty", "-m_").ret == 0
yield gitroot

Expand Down Expand Up @@ -100,7 +98,7 @@ def test_should_return_command_that_list_all_changed_files(self):
"diff",
"--name-status",
"--relative",
"master",
"main",
]

def test_should_return_command_that_list_all_changed_files_for_different_branch(
Expand Down
2 changes: 1 addition & 1 deletion tests/test_pytest_picked.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ def test_should_accept_different_parent_branch_param(testdir, tmpdir):
output = b"M test_flows.py\nA test_serializers.py\n"
subprocess_mock.return_value.stdout = output

result = testdir.runpytest("--picked", "--mode=branch", "--parent-branch=main")
result = testdir.runpytest("--picked", "--mode=branch", "--parent-branch=dev")
testdir.makepyfile(
".py",
test_flows="""
Expand Down

0 comments on commit 78c0a25

Please sign in to comment.