Skip to content

Commit

Permalink
Keeping only git compatibility. Improved tests and actions.
Browse files Browse the repository at this point in the history
* removed vcs types and moved flake test out of python.

* Improved tests and github action

* Added python 3.5 and 3.6

* test now using matrix as list
  • Loading branch information
MaxandreOgeret authored Feb 12, 2023
1 parent b6ffd44 commit c927c07
Show file tree
Hide file tree
Showing 11 changed files with 30 additions and 703 deletions.
4 changes: 4 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[flake8]
extend-ignore = A003,D100,D101,D102,D103,D104,D105,D107
exclude = .git,__pycache__,docs/source/conf.py,old,build,dist,venv
import-order-style=google
52 changes: 25 additions & 27 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,34 +8,32 @@ on:
jobs:
build:

runs-on: ${{ matrix.os }}
runs-on: ${{ matrix.cfg.os }}
strategy:
matrix:
os: [ubuntu-latest]
python-version: [3.5, 3.6, 3.7, 3.8]
include:
- os: macos-latest
python-version: 3.8
- os: windows-latest
python-version: 3.8
cfg:
- {os: ubuntu-18.04, python-version: "3.5"}
- {os: ubuntu-18.04, python-version: "3.6"}
- {os: ubuntu-20.04, python-version: "3.7"}
- {os: ubuntu-20.04, python-version: "3.8"}
- {os: ubuntu-20.04, python-version: "3.9"}
- {os: ubuntu-20.04, python-version: "3.10"}

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
python -m pip install --upgrade PyYAML
- name: Install dependencies (macOS)
run: |
brew install subversion mercurial
if: matrix.os == 'macos-latest'
- name: Test with pytest
run: |
pip install --upgrade coverage flake8 flake8-docstrings flake8-import-order pytest
git config --global --add init.defaultBranch master
git config --global --add advice.detachedHead true
${{ matrix.os == 'windows-latest' && 'set PYTHONPATH=%cd% &&' || 'PYTHONPATH=`pwd`' }} pytest -s -v test
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.cfg.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.cfg.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools wheel pyyaml
pip install pytest-flake8
- name: Lint with flake8
run: |
flake8 . --show-source --statistics
- name: Test with pytest
run: |
git config --global --add init.defaultBranch master
git config --global --add advice.detachedHead true
pytest -s -v
9 changes: 1 addition & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,7 @@ vcstool2 invokes the native VCS client with the requested command (i.e. *diff*).

## Which VCS types are supported?

Vcstool2 supports:

- [Git](http://git-scm.com)
- [Mercurial](http://git-scm.comhttp://mercurial.selenic.com)
- [Subversion](http://subversion.apache.org)
- [Bazaar](http://bazaar.canonical.com/en/)

The support for Mercurial, Subversion and Bazaar will be dropped in the future.
Vcstool2 supports [Git](http://git-scm.com) only.

## How to use vcstool2?

Expand Down
3 changes: 0 additions & 3 deletions test/clients.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
The available VCS clients are:
bzr
git
hg
svn
tar
zip
17 changes: 0 additions & 17 deletions test/list2.repos

This file was deleted.

19 changes: 0 additions & 19 deletions test/test_commands.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import os
from shutil import which
import subprocess
import sys
import unittest
Expand All @@ -13,20 +12,10 @@

REPOS_FILE = os.path.join(os.path.dirname(__file__), 'list.repos')
REPOS_FILE_URL = file_uri_scheme + REPOS_FILE
REPOS2_FILE = os.path.join(os.path.dirname(__file__), 'list2.repos')
TEST_WORKSPACE = os.path.join(
os.path.dirname(os.path.dirname(__file__)), 'test_workspace')

CI = os.environ.get('CI') == 'true' # Travis CI / Github actions set: CI=true
svn = which('svn')
hg = which('hg')
if svn:
# check if the svn executable is usable (on macOS)
# and not only exists to state that the program is not installed
try:
subprocess.check_call([svn, '--version'])
except subprocess.CalledProcessError:
svn = False


class TestCommands(unittest.TestCase):
Expand Down Expand Up @@ -326,14 +315,6 @@ def test_validate(self):
expected = get_expected_output('validate_hide')
self.assertEqual(output, expected)

@unittest.skipIf(not svn and not CI, '`svn` was not found')
@unittest.skipIf(not hg and not CI, '`hg` was not found')
def test_validate_svn_and_hg(self):
output = run_command(
'validate', ['--input', REPOS2_FILE])
expected = get_expected_output('validate2')
self.assertEqual(output, expected)

def test_remote(self):
output = run_command('remotes', args=['--repos'])
expected = get_expected_output('remotes_repos')
Expand Down
66 changes: 0 additions & 66 deletions test/test_flake8.py

This file was deleted.

9 changes: 0 additions & 9 deletions test/validate2.txt

This file was deleted.

18 changes: 0 additions & 18 deletions vcstool/clients/__init__.py
Original file line number Diff line number Diff line change
@@ -1,29 +1,11 @@
vcstool_clients = []

try:
from .bzr import BzrClient
vcstool_clients.append(BzrClient)
except ImportError:
pass

try:
from .git import GitClient
vcstool_clients.append(GitClient)
except ImportError:
pass

try:
from .hg import HgClient
vcstool_clients.append(HgClient)
except ImportError:
pass

try:
from .svn import SvnClient
vcstool_clients.append(SvnClient)
except ImportError:
pass

try:
from .tar import TarClient
vcstool_clients.append(TarClient)
Expand Down
Loading

0 comments on commit c927c07

Please sign in to comment.