Skip to content

Commit

Permalink
Switch testing to tox + compatibility with qtile 0.14
Browse files Browse the repository at this point in the history
  • Loading branch information
numirias committed Jul 9, 2019
1 parent daf581f commit 957e002
Show file tree
Hide file tree
Showing 12 changed files with 120 additions and 436 deletions.
8 changes: 8 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[run]
branch = True
source = plasma

[paths]
source =
plasma
.tox/*/lib/python*/site-packages/plasma
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ __pycache__/
*$py.class
*.egg-info/
.coverage
.coverage.*
.cache/
build/
dist/
Expand Down
12 changes: 8 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,13 @@ addons:
apt:
packages:
- xserver-xephyr
jobs:
include:
- python: 3.6
env: TOXENV=lint
install:
- make
- pip install tox-travis codecov
script:
- make test
- make lint
- make codecov
- tox
after_success:
- codecov
19 changes: 0 additions & 19 deletions Makefile

This file was deleted.

23 changes: 0 additions & 23 deletions Pipfile

This file was deleted.

346 changes: 0 additions & 346 deletions Pipfile.lock

This file was deleted.

2 changes: 1 addition & 1 deletion lib/qtile
Submodule qtile updated 221 files
2 changes: 1 addition & 1 deletion plasma/layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def configure(self, client, screen):
width-2*border_width,
height-2*border_width,
border_width,
self.group.qtile.colorPixel(border_color),
self.group.qtile.color_pixel(border_color),
margin=self.margin,
)
# Always keep tiles below floating windows
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
url='https://github.com/numirias/qtile-plasma',
license='MIT',
python_requires='>=3',
install_requires=['xcffib', 'qtile'],
install_requires=['xcffib>=0.5.0', 'qtile>=0.14.2'],
classifiers=[
'Development Status :: 4 - Beta',
'License :: OSI Approved :: MIT License',
Expand Down
8 changes: 8 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
from pathlib import Path
import sys

from pytest import fixture

from plasma.node import Node

# We borrow Qtile's testing framework. That's not elegant but the best option.
sys.path.insert(0, str(Path(__file__).parents[1] / 'lib')) # noqa: E402
from qtile.test.conftest import pytest_addoption



Node.min_size_default = 10

Expand Down
82 changes: 41 additions & 41 deletions tests/test_layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,19 @@
from qtile.libqtile import config
from qtile.libqtile.layout import Floating
from qtile.test.conftest import no_xinerama, qtile, xephyr, xvfb # noqa: F401
from qtile.test.layouts.layout_utils import assertFocused
from qtile.test.layouts.layout_utils import assert_focused


@fixture
def grid(qtile):
qtile.testWindow('a')
qtile.testWindow('b')
qtile.test_window('a')
qtile.test_window('b')
qtile.c.layout.previous()
qtile.c.layout.mode_vertical()
qtile.testWindow('c')
qtile.test_window('c')
qtile.c.layout.right()
qtile.c.layout.mode_vertical()
qtile.testWindow('d')
qtile.test_window('d')

class Config:

Expand Down Expand Up @@ -81,44 +81,44 @@ def test_access(self, root):

@plasma_config
def test_info(self, qtile):
qtile.testWindow('a')
qtile.testWindow('b')
qtile.test_window('a')
qtile.test_window('b')
assert qtile.c.layout.info()['tree'] == ['a', 'b']

@plasma_config
def test_windows(self, qtile):
qtile.testWindow('a')
qtile.testWindow('b')
qtile.testWindow('c')
assertFocused(qtile, 'c')
qtile.test_window('a')
qtile.test_window('b')
qtile.test_window('c')
assert_focused(qtile, 'c')
assert tree(qtile) == ['a', 'b', 'c']

@plasma_config
def test_split_directions(self, qtile):
qtile.testWindow('a')
qtile.test_window('a')
qtile.c.layout.mode_horizontal()
qtile.testWindow('b')
qtile.test_window('b')
qtile.c.layout.mode_vertical()
qtile.testWindow('c')
qtile.test_window('c')
assert tree(qtile) == ['a', ['b', 'c']]

@plasma_config
def test_directions(self, qtile, grid):
assertFocused(qtile, 'd')
assert_focused(qtile, 'd')
qtile.c.layout.left()
assertFocused(qtile, 'c')
assert_focused(qtile, 'c')
qtile.c.layout.up()
assertFocused(qtile, 'a')
assert_focused(qtile, 'a')
qtile.c.layout.right()
assertFocused(qtile, 'b')
assert_focused(qtile, 'b')
qtile.c.layout.down()
assertFocused(qtile, 'd')
assert_focused(qtile, 'd')
qtile.c.layout.down()
assertFocused(qtile, 'd')
assert_focused(qtile, 'd')
qtile.c.layout.previous()
assertFocused(qtile, 'b')
assert_focused(qtile, 'b')
qtile.c.layout.next()
assertFocused(qtile, 'd')
assert_focused(qtile, 'd')

@plasma_config
def test_move(self, qtile, grid):
Expand Down Expand Up @@ -146,10 +146,10 @@ def test_integrate(self, qtile, grid):

@plasma_config
def test_sizes(self, qtile):
qtile.testWindow('a')
qtile.testWindow('b')
qtile.test_window('a')
qtile.test_window('b')
qtile.c.layout.mode_vertical()
qtile.testWindow('c')
qtile.test_window('c')
info = qtile.c.window.info()
assert info['x'] == 400
assert info['y'] == 300
Expand Down Expand Up @@ -179,8 +179,8 @@ def test_sizes(self, qtile):

@plasma_config
def test_remove(self, qtile):
a = qtile.testWindow('a')
b = qtile.testWindow('b')
a = qtile.test_window('a')
b = qtile.test_window('b')
assert tree(qtile) == ['a', 'b']
qtile.kill_window(a)
assert tree(qtile) == ['b']
Expand All @@ -189,34 +189,34 @@ def test_remove(self, qtile):

@plasma_config
def test_split_mode(self, qtile):
qtile.testWindow('a')
qtile.testWindow('b')
qtile.test_window('a')
qtile.test_window('b')
qtile.c.layout.mode_horizontal_split()
qtile.testWindow('c')
qtile.test_window('c')
assert qtile.c.window.info()['width'] == 200 - 2
qtile.c.layout.mode_vertical()
qtile.testWindow('d')
qtile.test_window('d')
assert qtile.c.window.info()['height'] == 300 - 2
qtile.testWindow('e')
qtile.test_window('e')
assert qtile.c.window.info()['height'] == 200 - 2
qtile.c.layout.mode_vertical_split()
qtile.testWindow('f')
qtile.test_window('f')
assert qtile.c.window.info()['height'] == 100 - 2

@plasma_config
def test_recent(self, qtile):
qtile.testWindow('a')
qtile.testWindow('b')
qtile.testWindow('c')
assertFocused(qtile, 'c')
qtile.test_window('a')
qtile.test_window('b')
qtile.test_window('c')
assert_focused(qtile, 'c')
qtile.c.layout.recent()
assertFocused(qtile, 'b')
assert_focused(qtile, 'b')
qtile.c.layout.recent()
assertFocused(qtile, 'c')
assert_focused(qtile, 'c')
qtile.c.layout.next()
assertFocused(qtile, 'a')
assert_focused(qtile, 'a')
qtile.c.layout.recent()
assertFocused(qtile, 'c')
assert_focused(qtile, 'c')

def test_bug_10(self):
"""Adding nodes when the correct root dimensions are still unknown
Expand Down
51 changes: 51 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
[tox]
envlist = py35,py36,py37,lint,coverage-report

[testenv]
deps =
setuptools>=41
xcffib
coverage
pytest<5.0.0
pytest-xdist
commands =
coverage run --parallel -m pytest -v {posargs} tests/

[testenv:coverage-report]
basepython = python3.7
skip_install = true
deps = coverage
commands =
coverage combine
coverage report

[testenv:lint]
deps =
xcffib
flake8
pylint
commands =
flake8 plasma/
pylint --rcfile setup.cfg plasma/

[testenv:release]
deps =
wheel
twine
commands =
rm -rf *.egg-info build/ dist/
python setup.py bdist_wheel sdist
twine upload -r pypi dist/*
rm -rf *.egg-info build/ dist/

[pylint]
disable =
missing-docstring,
invalid-name,
unused-argument,
too-few-public-methods,
too-many-public-methods,
protected-access,
no-self-use,
too-many-instance-attributes,
fixme,

0 comments on commit 957e002

Please sign in to comment.