Skip to content

Commit

Permalink
Merge pull request #234 from wazo-platform/add-precommit
Browse files Browse the repository at this point in the history
Pull request for add-precommit

Reviewed-by: wazo-community-zuul[bot]
  • Loading branch information
wazo-community-zuul[bot] authored Jan 25, 2024
2 parents 1b323ec + 59a4074 commit d411da3
Show file tree
Hide file tree
Showing 46 changed files with 123 additions and 209 deletions.
23 changes: 23 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,26 @@ repos:
- id: flake8
# Required to make flake8 read from pyproject.toml for now :(
additional_dependencies: ["flake8-pyproject"]
# Automatically update to modern python (as modern as allowed by your Python version)
- repo: https://github.com/asottile/pyupgrade
rev: v3.15.0
hooks:
- id: pyupgrade
args: [--py39-plus]
# Automatically sort and format imports (in black compatible way)
- repo: https://github.com/pycqa/isort
rev: 5.12.0
hooks:
- id: isort
args: [--filter-files]
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-toml
- repo: https://github.com/wazo-platform/wazo-git-hooks
rev: 1.1.1
hooks:
- id: wazo-copyright-check
4 changes: 2 additions & 2 deletions features/daily/bsfilter.feature
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Feature: Boss Secretary Filter
Then "Charlie Unknown" is ringing
Then "Angel 001" is hungup
When "Bad Guy" hangs up

When "Angel 001" press function key "1"
When I wait 2 seconds for the call processing
When I wait 3 seconds to play message
Expand All @@ -61,7 +61,7 @@ Feature: Boss Secretary Filter
When I wait 2 seconds for the call processing
Then "Charlie Unknown" is ringing
Then "Angel 001" is hungup

Scenario: Strategy "all"
Given there are telephony users with infos:
| firstname | lastname | exten | context | with_phone |
Expand Down
2 changes: 1 addition & 1 deletion features/daily/contact-center-stats.feature
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Feature: Stats generation
| name | exten | context | agents |
| stat-queue | 3521 | default | 1003 |
Given there are no hour change in the next 30 seconds

# First cycle
When I log agent "1003" from API
When I pause agent "1003"
Expand Down
6 changes: 3 additions & 3 deletions features/daily/integration-asterisk-queuelog.feature
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ Feature: Stats generation
| firstname | lastname | exten | context | with_phone | agent_number |
| Agent | 012 | 1512 | default | yes | 012 |
Given there are queues with infos:
| name | exten | context | timeout | option_timeout | agents |
| name | exten | context | timeout | option_timeout | agents |
| q12 | 3512 | default | 10 | 5 | 012 |
Given agent "012" is logged
When chan_test calls "3512@default" with caller ID name "3512-1"
Expand All @@ -200,7 +200,7 @@ Feature: Stats generation
| firstname | lastname | exten | context | with_phone | agent_number |
| Agent | 014 | 1514 | default | yes | 014 |
Given there are queues with infos:
| name | exten | context | timeout | option_timeout | agents |
| name | exten | context | timeout | option_timeout | agents |
| q14 | 3514 | default | 10 | 5 | 014 |
Given agent "014" is logged
When I pause agent "014"
Expand All @@ -214,7 +214,7 @@ Feature: Stats generation
| firstname | lastname | exten | context | with_phone | agent_number |
| Agent | 015 | 1515 | default | yes | 015 |
Given there are queues with infos:
| name | exten | context | option_wrapuptime | agents |
| name | exten | context | option_wrapuptime | agents |
| q15 | 3515 | default | 5 | 015 |
Given agent "015" is logged
When chan_test calls "3515@default" with id "3515-1"
Expand Down
2 changes: 1 addition & 1 deletion features/daily/switchboard.feature
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,6 @@ Feature: Switchboards
Then switchboard "no-timeout" has "i-will-not-timeout-1" in queued calls
Then switchboard "no-fallback" has "i-will-not-timeout-2" in queued calls

# Should be Caller ID "i-will-be-transferred-to-switchboard",
# Should be Caller ID "i-will-be-transferred-to-switchboard",
# but is "Reception Clerk" due to an Asterisk bug on Local channels
Then switchboard "transfer-destination" has "Reception Clerk" in queued calls
4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,7 @@ ignore = [
exclude = [
".tox",
]

[tool.isort]
profile = "black"
py_version = 39
5 changes: 2 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
#!/usr/bin/env python3
# Copyright 2019 The Wazo Authors (see the AUTHORS file)
# Copyright 2019-2024 The Wazo Authors (see the AUTHORS file)
# SPDX-License-Identifier: GPL-3.0-or-later

from setuptools import setup
from setuptools import find_packages
from setuptools import find_packages, setup

setup(
name='wazo-acceptance',
Expand Down
4 changes: 2 additions & 2 deletions wazo_acceptance/assets/wazo-service-test.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/usr/bin/env python3
# Copyright 2016-2023 The Wazo Authors (see the AUTHORS file)
# Copyright 2016-2024 The Wazo Authors (see the AUTHORS file)
# SPDX-License-Identifier: GPL-3.0-or-later

import subprocess
import re
import subprocess

BASE_SERVICES = [
'asterisk',
Expand Down
7 changes: 3 additions & 4 deletions wazo_acceptance/config.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
# Copyright 2014-2023 The Wazo Authors (see the AUTHORS file)
# Copyright 2014-2024 The Wazo Authors (see the AUTHORS file)
# SPDX-License-Identifier: GPL-3.0-or-later

import logging
import os

from copy import deepcopy
from xivo.config_helper import parse_config_dir
from xivo.chain_map import ChainMap

from xivo.chain_map import ChainMap
from xivo.config_helper import parse_config_dir

logger = logging.getLogger(__name__)

Expand Down
3 changes: 2 additions & 1 deletion wazo_acceptance/debug.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Copyright 2015-2022 The Wazo Authors (see the AUTHORS file)
# Copyright 2015-2024 The Wazo Authors (see the AUTHORS file)
# SPDX-License-Identifier: GPL-3.0-or-later

import logging

import requests

loggers = {
Expand Down
7 changes: 2 additions & 5 deletions wazo_acceptance/environment.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2013-2023 The Wazo Authors (see the AUTHORS file)
# Copyright 2013-2024 The Wazo Authors (see the AUTHORS file)
# SPDX-License-Identifier: GPL-3.0-or-later
from __future__ import annotations

Expand All @@ -9,10 +9,7 @@
from xivo.pubsub import Pubsub
from xivo.xivo_logging import setup_logging as wazo_setup_logging

from . import (
debug,
setup
)
from . import debug, setup
from .config import load_config

logger = logging.getLogger('acceptance')
Expand Down
6 changes: 3 additions & 3 deletions wazo_acceptance/helpers/bus.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# Copyright 2019-2023 The Wazo Authors (see the AUTHORS file)
# Copyright 2019-2024 The Wazo Authors (see the AUTHORS file)
# SPDX-License-Identifier: GPL-3.0-or-later
from __future__ import annotations

import logging
import functools
import logging
import queue
import threading

from contextlib import contextmanager

from hamcrest import assert_that, has_entries
from wazo_test_helpers import until

Expand Down
6 changes: 1 addition & 5 deletions wazo_acceptance/helpers/provd.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@
# SPDX-License-Identifier: GPL-3.0-or-later

import requests
from hamcrest import (
assert_that,
is_,
)

from hamcrest import assert_that, is_
from wazo_provd_client import operation
from wazo_provd_client.exceptions import ProvdError
from wazo_test_helpers import until
Expand Down
5 changes: 2 additions & 3 deletions wazo_acceptance/helpers/sip_config.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
# Copyright 2018-2023 The Wazo Authors (see the AUTHORS file)
# Copyright 2018-2024 The Wazo Authors (see the AUTHORS file)
# SPDX-License-Identifier: GPL-3.0-or-later

from collections import namedtuple
import subprocess

from collections import namedtuple

SIPConfig = namedtuple('SIPConfig', ('sip_port', 'rtp_port', 'sip_name', 'sip_passwd', 'sip_host'))

Expand Down
7 changes: 2 additions & 5 deletions wazo_acceptance/helpers/sip_phone.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
# Copyright 2015-2023 The Wazo Authors (see the AUTHORS file)
# Copyright 2015-2024 The Wazo Authors (see the AUTHORS file)
# SPDX-License-Identifier: GPL-3.0-or-later

import datetime
import logging
import sys
import time

from linphonelib import (
LinphoneException,
Session,
)
from linphonelib import LinphoneException, Session
from linphonelib.commands import CallStatus, RegisterStatus

logger = logging.getLogger('linphone')
Expand Down
3 changes: 1 addition & 2 deletions wazo_acceptance/helpers/utils.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
# Copyright 2020-2021 The Wazo Authors (see the AUTHORS file)
# Copyright 2020-2024 The Wazo Authors (see the AUTHORS file)
# SPDX-License-Identifier: GPL-3.0-or-later

import random
import string

from contextlib import contextmanager


Expand Down
3 changes: 1 addition & 2 deletions wazo_acceptance/main.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2014-2020 The Wazo Authors (see the AUTHORS file)
# Copyright 2014-2024 The Wazo Authors (see the AUTHORS file)
# SPDX-License-Identifier: GPL-3.0-or-later

import argparse
Expand All @@ -10,7 +10,6 @@
from . import prerequisite
from .config import load_config


logger = logging.getLogger(__name__)


Expand Down
7 changes: 2 additions & 5 deletions wazo_acceptance/prerequisite.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2013-2023 The Wazo Authors (see the AUTHORS file)
# Copyright 2013-2024 The Wazo Authors (see the AUTHORS file)
# SPDX-License-Identifier: GPL-3.0-or-later

import logging
Expand All @@ -7,10 +7,7 @@
from requests.exceptions import HTTPError
from xivo.pubsub import Pubsub

from . import (
debug,
setup,
)
from . import debug, setup
from .config import load_config

logger = logging.getLogger(__name__)
Expand Down
11 changes: 4 additions & 7 deletions wazo_acceptance/setup.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
# Copyright 2015-2023 The Wazo Authors (see the AUTHORS file)
# Copyright 2015-2024 The Wazo Authors (see the AUTHORS file)
# SPDX-License-Identifier: GPL-3.0-or-later

import ari
import logging

import ari
from requests.exceptions import HTTPError

from wazo_amid_client import Client as AmidClient
from wazo_agentd_client import Client as AgentdClient
from wazo_amid_client import Client as AmidClient
from wazo_auth_client import Client as AuthClient
from wazo_call_logd_client import Client as CallLogdClient
from wazo_calld_client import Client as CalldClient
Expand All @@ -18,9 +17,7 @@
from wazo_setupd_client import Client as SetupdClient
from wazo_websocketd_client import Client as WebsocketdClient

from . import auth
from . import debug
from . import helpers
from . import auth, debug, helpers
from .phone_register import PhoneRegister
from .ssh import SSHClient
from .sysutils import RemoteSysUtils
Expand Down
4 changes: 2 additions & 2 deletions wazo_acceptance/steps/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2019-2022 The Wazo Authors (see the AUTHORS file)
# Copyright 2019-2024 The Wazo Authors (see the AUTHORS file)
# SPDX-License-Identifier: GPL-3.0-or-later

from .agent import * # noqa
Expand All @@ -10,8 +10,8 @@
from .bus import * # noqa
from .call import * # noqa
from .call_filter import * # noqa
from .call_permission import * # noqa
from .call_log import * # noqa
from .call_permission import * # noqa
from .conference import * # noqa
from .coredump import * # noqa
from .debian import * # noqa
Expand Down
4 changes: 2 additions & 2 deletions wazo_acceptance/steps/agent.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright 2019-2023 The Wazo Authors (see the AUTHORS file)
# Copyright 2019-2024 The Wazo Authors (see the AUTHORS file)
# SPDX-License-Identifier: GPL-3.0-or-later

from behave import given, when, then
from behave import given, then, when
from hamcrest import assert_that, not_


Expand Down
13 changes: 3 additions & 10 deletions wazo_acceptance/steps/application.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,8 @@
# Copyright 2019-2021 The Wazo Authors (see the AUTHORS file)
# Copyright 2019-2024 The Wazo Authors (see the AUTHORS file)
# SPDX-License-Identifier: GPL-3.0-or-later

from behave import (
given,
then,
when,
)
from hamcrest import (
assert_that,
equal_to,
)
from behave import given, then, when
from hamcrest import assert_that, equal_to
from wazo_test_helpers import until


Expand Down
11 changes: 2 additions & 9 deletions wazo_acceptance/steps/asterisk.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,8 @@
# Copyright 2019-2023 The Wazo Authors (see the AUTHORS file)
# Copyright 2019-2024 The Wazo Authors (see the AUTHORS file)
# SPDX-License-Identifier: GPL-3.0-or-later

from behave import then

from hamcrest import (
assert_that,
equal_to,
has_entries,
has_item,
not_,
)
from hamcrest import assert_that, equal_to, has_entries, has_item, not_
from wazo_test_helpers import until

FUNCKEYS_EXTEN = {
Expand Down
9 changes: 2 additions & 7 deletions wazo_acceptance/steps/auth.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
# Copyright 2019-2022 The Wazo Authors (see the AUTHORS file)
# Copyright 2019-2024 The Wazo Authors (see the AUTHORS file)
# SPDX-License-Identifier: GPL-3.0-or-later

from behave import given, then, when
from hamcrest import assert_that, is_not, none
from behave import (
given,
then,
when,
)

from wazo_auth_client import Client as AuthClient


Expand Down
3 changes: 2 additions & 1 deletion wazo_acceptance/steps/backup.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Copyright 2013-2019 The Wazo Authors (see the AUTHORS file)
# Copyright 2013-2024 The Wazo Authors (see the AUTHORS file)
# SPDX-License-Identifier: GPL-3.0-or-later

from behave import given, when

from .. import auth

BACKUP_MANAGER = 'wazo-backup-manager'
Expand Down
Loading

0 comments on commit d411da3

Please sign in to comment.