Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
21 changes: 0 additions & 21 deletions .github/workflows/python-linter.yaml

This file was deleted.

39 changes: 39 additions & 0 deletions .github/workflows/python-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Code Style + Testing

on: [push, pull_request]

jobs:
test:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v2

- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: "3.10"

- name: Upgrade Pip
run: |
pip install --upgrade pip

- name: Install Poetry
uses: snok/install-poetry@v1

- name: Install dependencies
run: |
poetry install --no-interaction --no-ansi

- name: Code Style
run: |
poetry run flake8 . --exit-zero
poetry run black --check .

- name: Testing
run: |
poetry run coverage run -m pytest .

- name: Coverage
run: |
poetry run coverage report -m
304 changes: 250 additions & 54 deletions poetry.lock

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ flake8-black = "^0.2.4"
pytest = "^7.1.1"
coverage = {extras = ["toml"], version = "^6.3.2"}
coveralls = "^3.3.1"
pytest-timeout = "^2.1.0"

[build-system]
requires = ["poetry-core>=1.0.0"]
Expand Down
11 changes: 1 addition & 10 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ max-complexity = 27
exclude = .git,__pycache__,.venv,venv,.eggs,*.egg,testing,stowaway,carrier,cargo
ignore = D100, D104, D106, D401, X100, W503, W504, RST303, RST304, DAR103, DAR203


[isort]
include_trailing_comma = true
use_parentheses = true
Expand All @@ -21,23 +20,15 @@ force_grid_wrap = 0
ensure_newline_before_comments = True
line_length = 120


[tool:pytest]
timeout = 5
norecursedirs = *.egg .eggs dist build docs .tox .git __pycache__
addopts =
--strict-markers
--strict-config
--doctest-modules
--fail-on-template-vars
--dup-fixtures
--tb=short
--cov=server
--cov=tests
--cov-branch
--cov-report=term-missing:skip-covered
--cov-report=html
--cov-fail-under=100
--ignore=.github

[mypy]
allow_redefinition = False
Expand Down
41 changes: 41 additions & 0 deletions test/deckfile/deck.empty.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
version: "1"

cluster:
provider: k3d
minVersion: 4.0.0
name: test-empty-file
nativeConfig:
apiVersion: k3d.io/v1alpha4
kind: Simple
servers: 1
agents: 1
image: rancher/k3s:v1.22.9-k3s1
options:
k3s:
extraArgs:
- arg: --disable=traefik
nodeFilters:
- server:*
ports:
- port: 61346:80
nodeFilters:
- loadbalancer
- port: 8443:443
nodeFilters:
- loadbalancer
- port: 31820:31820/UDP
nodeFilters:
- agent:0

decks:
- name: empty
namespace: default
sources:
- type: file
ref: content
content:
{
"kind": "Namespace",
"apiVersion": "v1",
"metadata": { "name": "content", "labels": { "name": "content" } },
}
14 changes: 14 additions & 0 deletions test/test_deckfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
from unittest import TestCase
from getdeck.configuration import default_configuration
from getdeck.utils import read_deckfile_from_location


class DeckFileLocationTest(TestCase):
def test_local(self):
location = "./test/deckfile/deck.empty.yaml"
deckfile, working_dir_path, is_temp_dir = read_deckfile_from_location(
location, default_configuration
)
self.assertIsNotNone(deckfile)
self.assertEqual(working_dir_path, "./test/deckfile")
self.assertFalse(is_temp_dir)