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

Add integration tests #66

Open
wants to merge 52 commits into
base: add-tests
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
17fdda6
Add initial tests
techalchemy Sep 17, 2018
4186a0c
Clean up options and add virtualenv module
techalchemy Sep 18, 2018
c431ae6
Add tests (clean is still failing)
techalchemy Sep 18, 2018
bf4fa23
Wheel installation into virtualenv works
techalchemy Sep 18, 2018
ac6929b
Update setup.cfg
techalchemy Sep 18, 2018
194cd50
Implement working versions of clean and install inside virtualenvs
techalchemy Sep 19, 2018
8ee990e
Fix cleaning working set and messaging
techalchemy Sep 20, 2018
b1a7bf7
Fix tests
techalchemy Sep 27, 2018
2a40250
Update tox and add mork, installer and virtualenv dependencies
techalchemy Sep 27, 2018
afe8e51
Swap to mork implementation for testing
techalchemy Sep 28, 2018
28bf2f0
Update CI configs
techalchemy Sep 30, 2018
57bac36
Add deprecation warning ignores to test runners
techalchemy Sep 30, 2018
06f1af8
Add project fixtures, venv support
techalchemy Sep 30, 2018
7ed8fbe
Add clean, install and lock tests
techalchemy Sep 30, 2018
c5a516a
Add sync and remove tests
techalchemy Sep 30, 2018
d6e2aa4
Monkeypatch distlib metadata to work with version 2.1
techalchemy Oct 1, 2018
246eccd
Update lockfile
techalchemy Oct 1, 2018
1f48d03
Update pipfile and lockfile
techalchemy Oct 1, 2018
4dc19fd
Fix packing
techalchemy Oct 2, 2018
b1f2e17
Fix package task
techalchemy Sep 21, 2018
c47b7a6
Add LRU cache for cacheable function calls
techalchemy Sep 22, 2018
404b9e0
Drop markers from editable requirements
techalchemy Sep 22, 2018
0ffc28e
Add PySpec object to handle comparison and consolidation
techalchemy Sep 22, 2018
2345480
Cleanup
techalchemy Sep 23, 2018
82d3c70
Fix virtualenv usage and Set inheritance
techalchemy Sep 23, 2018
703c8c5
update lockfile?
techalchemy Sep 26, 2018
85de00e
Finalize marker intersection logic
techalchemy Sep 27, 2018
2c7f670
Clean up PySpec intersection methods
techalchemy Oct 2, 2018
3c9a86c
Force upgrades
techalchemy Oct 3, 2018
d26f485
Add assertion for debugging travis
techalchemy Oct 3, 2018
4d72b7a
Fix lru cache install
techalchemy Oct 3, 2018
18e6501
Fix specifier math
techalchemy Oct 4, 2018
fc759b3
Fix mork invocations
techalchemy Apr 8, 2019
e622517
Merge branch 'master' into fix-marker-duplication
techalchemy Apr 8, 2019
49aa390
mocked pypi server
Sep 19, 2019
62d5769
Remove finder argument to `build_wheel`
Sep 20, 2019
7d93589
setup github actions
Sep 20, 2019
0f14f8e
Refactor synchronizers to allow easy mock
Sep 26, 2019
086921b
update pipfiles
Sep 26, 2019
586c90c
more patches
Sep 26, 2019
289c4a3
allow makedir fail when creating cache
Sep 26, 2019
cd05bd2
fix argument error
Sep 27, 2019
cf4ee23
Deduplicate early to speed up metadata setting
Sep 27, 2019
8249ae4
VCS download mocked!
Sep 27, 2019
f9af54a
use patched yaspin
Sep 27, 2019
a0835bd
add environment for install manager
Sep 27, 2019
7c96e4f
Fix installating and locking for editable pkgs
Sep 28, 2019
2682a8e
add some news
Sep 28, 2019
8024741
merge branch 'add-tests-frost'
Sep 30, 2019
bc0b1f4
merge conflicts
Sep 30, 2019
1644593
Merge pull request #59 from sarugaku/fix-marker-duplication
frostming Sep 30, 2019
4097493
Reliably copy the requirement object
Sep 30, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,7 @@ insert_final_newline = true
[*.md]
trim_trailing_whitespace = false

[*.toml]
indent_size = 2

[*.yaml]
[*.{toml,yaml,yml}]
indent_size = 2

# Makefiles always use tabs for indentation
Expand Down
71 changes: 71 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: Continuous Integration and Deployment

on: [push]

jobs:
build:

runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
max-parallel: 6
matrix:
python-version: [2.7, 3.5, 3.6, 3.7]
os: [ubuntu-latest, macOS-latest, windows-latest]

steps:
- uses: actions/checkout@v1
with:
submodules: true
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Setup build and test environment
run: |
python -m pip install --upgrade "pip<19.2.0" setuptools wheel
- name: Build Python Package
run: |
python -m pip install -e ".[tests,virtualenv]"
python -m pip install -e tests/pytest-pypi
# Temporarily pin tomlkit to lower version dueto sdispater/tomlkit/issues/56.
python -m pip install --upgrade "tomlkit<=0.5.3"
- name: Lint with flake8
run: |
python -m pip install flake8
flake8 --show-source src/ tests/
- name: Test with pytest
run: |
pytest -n auto --cov=passa --cov-report=xml
- name: Report code coverage
env:
CODECOV_TOKEN: ${{secrets.CODECOV_TOKEN}}
run: |
pip install codecov
coverage report
codecov

pack:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Set up Python 3.7
uses: actions/setup-python@v1
with:
python-version: 3.7
- name: Install Requirements
run: |
python -m pip install --upgrade "pip<19.2.0" check-manifest invoke
pip install -e ".[pack]"
- name: Check MANIFEST
run: |
check-manifest
- name: Packaging
run: |
invoke pack
python pack/passa.zip --help
- name: Upload packed result
uses: actions/upload-artifact@v1
with:
name: packed
path: pack/passa.zip
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/build
/dist
build/
dist/
/docs/_build
/pack
htmlcov/
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "tests/pypi"]
path = tests/pypi
url = https://github.com/sarugaku/pipenv-test-artifacts.git
44 changes: 0 additions & 44 deletions .travis.yml

This file was deleted.

1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ recursive-include docs Makefile *.rst *.py *.bat
recursive-exclude docs requirements*.txt

prune .github
prune .gitmodules
prune docs/build
prune news
prune tasks
Expand Down
5 changes: 3 additions & 2 deletions Pipfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[packages]
passa = {editable = true,path = '.',extras = ['virtualenv']}

passa = {editable = true,path = '.'}
tomlkit = "<=0.5.3"
yaspin = {file="https://github.com/sarugaku/yaspin/releases/download/v0.15.0post1/yaspin-0.15.0.post1-py2.py3-none-any.whl"}
# Override sdist-only dependency via TOMLkit to fix build. (sarugaku/passa#61)
[packages.functools32]
file = """\
Expand Down
917 changes: 559 additions & 358 deletions Pipfile.lock

Large diffs are not rendered by default.

22 changes: 0 additions & 22 deletions appveyor.yml

This file was deleted.

1 change: 1 addition & 0 deletions news/66.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix a bug that editable packages are not installed and locked properly.
6 changes: 6 additions & 0 deletions news/66.feature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Improve the integration testing
* Introduce ``pytest-pypi`` to mock the PyPI server for testing.
* Refactor ``synchronizers.py`` to make it easy to mock installation and uninstallation operations.
* Mock the VCS downloads for testing.
* Improve the performance of metadata resolving by deduplicating the metasests items.
* Switch to Github Pages as CI service.
1 change: 1 addition & 0 deletions news/67.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix a bug that ``strip_extras`` accidentally modifies the original requirement.
7 changes: 5 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,9 @@ python_requires = >=2.7,!=3.0,!=3.1,!=3.2,!=3.3
setup_requires = setuptools>=36.2.2
install_requires =
appdirs
backports.functools_lru_cache; python_version <= "3.4"
cached-property
distlib>=0.2.8
distlib
installer
packagebuilder
packaging
Expand All @@ -61,6 +62,8 @@ tests =
pytest-xdist
pytest-timeout
pytest-cov
pytest-mock
virtualenv
pytest

[options.entry_points]
Expand Down Expand Up @@ -95,7 +98,7 @@ ignore =
# E231: missing whitespace after ','
# E402: module level import not at top of file
# E501: line too long
E231,E402,E501
E231,E402,E501,W503

[tool:pytest]
strict = true
Expand Down
8 changes: 5 additions & 3 deletions src/passa/actions/clean.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@


def clean(project, default=True, dev=False, sync=True):
from passa.models.synchronizers import Cleaner
from passa.models.synchronizers import Synchronizer
from passa.operations.sync import clean

cleaner = Cleaner(project, default=default, develop=dev, sync=sync)
syncer = Synchronizer(
project, default=default, develop=dev, clean_unneeded=True, dry_run=not sync
)

success = clean(cleaner)
success = clean(syncer)
if not success:
return 1

Expand Down
6 changes: 3 additions & 3 deletions src/passa/actions/remove.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ def remove(project=None, only="default", packages=[], clean=True, sync=False):
if not clean:
return

from passa.models.synchronizers import Cleaner
from passa.models.synchronizers import Synchronizer
from passa.operations.sync import clean

cleaner = Cleaner(project, default=True, develop=True)
success = clean(cleaner)
syncer = Synchronizer(project, default=True, develop=True, clean_unneeded=True)
success = clean(syncer)
if not success:
return 1

Expand Down
2 changes: 1 addition & 1 deletion src/passa/actions/sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def sync(project=None, dev=False, clean=True):
project = project
syncer = Synchronizer(
project, default=True, develop=dev,
clean_unneeded=clean,
clean_unneeded=clean
)

success = sync(syncer)
Expand Down
3 changes: 2 additions & 1 deletion src/passa/cli/add.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ def run(self, options):
editables=options.editables,
project=options.project,
dev=options.dev,
clean=options.clean
clean=options.clean,
sync=options.sync
)


Expand Down
2 changes: 1 addition & 1 deletion src/passa/cli/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class Command(BaseCommand):

def run(self, options):
return install(project=options.project, check=options.check, dev=options.dev,
clean=options.clean)
clean=options.clean)


if __name__ == "__main__":
Expand Down
6 changes: 3 additions & 3 deletions src/passa/cli/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ def __init__(self, root, *args, **kwargs):
environment = kwargs.pop("environment", self.get_env())
if not pipfile.is_file():
raise argparse.ArgumentError(
"project", "{0!r} is not a Pipfile project".format(root),
None, "{0!r} is not a Pipfile project".format(root),
)
try:
super(Project, self).__init__(root.as_posix(), environment=environment,
*args, **kwargs)
*args, **kwargs)
except tomlkit.exceptions.ParseError as e:
raise argparse.ArgumentError(
"project", "failed to parse Pipfile: {0!r}".format(str(e)),
None, "failed to parse Pipfile: {0!r}".format(str(e)),
)

def get_env(self):
Expand Down
2 changes: 1 addition & 1 deletion src/passa/cli/remove.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class Command(BaseCommand):

def run(self, options):
return remove(project=options.project, only=options.only,
packages=options.packages, clean=options.clean, sync=options.sync)
packages=options.packages, clean=options.clean, sync=options.sync)


if __name__ == "__main__":
Expand Down
2 changes: 1 addition & 1 deletion src/passa/cli/upgrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class Command(BaseCommand):

def run(self, options):
return upgrade(project=options.project, strategy=options.strategy,
sync=options.sync, packages=options.packages)
sync=options.sync, packages=options.packages)


if __name__ == "__main__":
Expand Down
Loading