Skip to content

Commit

Permalink
Merge pull request #132 from ggozad/dev_deps
Browse files Browse the repository at this point in the history
Update black, ruff, pip, poetry
  • Loading branch information
ggozad authored Feb 2, 2023
2 parents 83958d4 + 7b74a0a commit c20f924
Show file tree
Hide file tree
Showing 17 changed files with 288 additions and 283 deletions.
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
repos:
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.0.190
rev: v0.0.239
hooks:
- id: ruff
args: ["--fix"]
- repo: https://github.com/psf/black
rev: 22.12.0
rev: 23.1.0
hooks:
- id: black
- repo: https://github.com/ggozad/gherkin-check
Expand Down
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ ENV PYTHONDONTWRITEBYTECODE 1
# Do not ever buffer console output
ENV PYTHONUNBUFFERED 1

RUN pip install --upgrade pip
RUN pip install poetry
RUN pip install supervisor

Expand Down
527 changes: 273 additions & 254 deletions poetry.lock

Large diffs are not rendered by default.

6 changes: 2 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,15 @@ behave = "^1.2.6"
splinter = "^0.18.1"
selenium = "^4"

[tool.poetry.dev-dependencies]
black = "^21.11b1"
pdbpp = "^0.10.3"

[tool.poetry.scripts]
mailmock = "behaving.mail.mock:main"
smsmock = "behaving.sms.mock:main"
gcmmock = "behaving.notifications.gcm.mock:main"

[tool.poetry.group.dev.dependencies]
ruff = "^0.0.190"
black = "^23.1.0"
pdbpp = "^0.10.3"

[tool.ruff]

Expand Down
4 changes: 3 additions & 1 deletion src/behaving/mail/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ def setup(context):
os.mkdir(path)
logger.info(f"No default mail path for mailmock is specified. Using {path}")
except OSError:
logger.error(f"No default mail path for mailmock is specified. Unable to create {path}")
logger.error(
f"No default mail path for mailmock is specified. Unable to create {path}"
)
exit(1)
context.mail_path = path
context.mail = FSInspector(context.mail_path)
Expand Down
4 changes: 2 additions & 2 deletions src/behaving/mail/mock.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

try:
from pync import Notifier

notifier = Notifier
except ImportError:
notifier = None
Expand Down Expand Up @@ -57,8 +58,7 @@ def process_message(


def main(args=sys.argv[1:]):
"""Main function called by `mailmock` command.
"""
"""Main function called by `mailmock` command."""
parser = argparse.ArgumentParser(description="Mail mock server")

parser.add_argument("-p", "--port", default="8025", help="The port to use")
Expand Down
1 change: 0 additions & 1 deletion src/behaving/notifications/gcm/steps.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ def should_not_have_received_gcm(context, device_id):

@when('I send a gcm message "{message}"')
def send_gcm_notification(context, message):

url = "http://localhost:8200"
req = Request(url, message.encode("utf-8"))

Expand Down
1 change: 0 additions & 1 deletion src/behaving/personas/steps.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

@given('"{name}" as the persona')
def given_a_persona(context, name):

if name not in context.personas:
context.personas[name] = Persona()
context.persona = context.personas[name]
Expand Down
3 changes: 1 addition & 2 deletions src/behaving/sms/mock.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,7 @@ def do_POST(self):


def main(args=sys.argv[1:]):
"""Main function called by `smsmock` command.
"""
"""Main function called by `smsmock` command."""
parser = argparse.ArgumentParser(description="SMS mock server")
parser.add_argument("-p", "--port", default="8199", help="The port to use")

Expand Down
2 changes: 0 additions & 2 deletions src/behaving/web/chrome.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@


class WebDriver(BaseWebDriver):

driver_name = "Chrome"

def __init__(
Expand All @@ -23,7 +22,6 @@ def __init__(
desired_capabilities=None,
**kwargs,
):

options = Options() if options is None else options

if user_agent is not None:
Expand Down
2 changes: 0 additions & 2 deletions src/behaving/web/electron.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@


class ElectronWebDriver(BaseWebDriver):

driver_name = "Electron"

def __init__(self, wait_time=2, fullscreen=False, binary=""):

dc = {}
dc["browserName"] = "electron"
dc["chromeOptions"] = {
Expand Down
5 changes: 2 additions & 3 deletions src/behaving/web/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,11 @@ def after_scenario(context, scenario):
and context.screenshots_dir
and hasattr(context, "browser")
):

filename = (
scenario.feature.name
+ u"-"
+ "-"
+ scenario.name
+ u"-"
+ "-"
+ time.strftime("%Y-%m-%d-%H%M%S", time.gmtime(time.time()))
)
filename = os.path.join(context.screenshots_dir, filename)
Expand Down
2 changes: 0 additions & 2 deletions src/behaving/web/firefox.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@


class WebDriver(BaseWebDriver):

driver_name = "Firefox"

def __init__(
Expand All @@ -30,7 +29,6 @@ def __init__(
wait_time=2,
desired_capabilities=None,
):

firefox_profile = FirefoxProfile(profile)
firefox_profile.set_preference("extensions.logging.enabled", False)
firefox_profile.set_preference("network.dns.disableIPv6", False)
Expand Down
2 changes: 0 additions & 2 deletions src/behaving/web/steps/browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ def reload(context):

@when("I go back")
def go_back(context):

context.browser.back()


Expand Down Expand Up @@ -148,7 +147,6 @@ def maximize_window(context):

@when("I take a screenshot")
def take_screenshot(context):

assert context.screenshots_dir != "", "no screenshots_dir specified"

filename = (
Expand Down
1 change: 0 additions & 1 deletion src/behaving/web/steps/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,6 @@ def i_press(context, name):
@when('I press the element with xpath "{xpath}"')
@persona_vars
def i_press_xpath(context, xpath):

button = context.browser.find_by_xpath(xpath)
assert button, f"Element with xpath {xpath} not found"
button.first.click()
Expand Down
4 changes: 2 additions & 2 deletions src/behaving/web/steps/frames.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from selenium.webdriver.common.by import By


@when(u'I switch to frame with css "{css}"')
@when('I switch to frame with css "{css}"')
def switch_to_frame(context, css):
driver = context.browser.driver
try:
Expand All @@ -13,6 +13,6 @@ def switch_to_frame(context, css):
driver.switch_to.frame(frame)


@when(u"I switch back to the main page")
@when("I switch back to the main page")
def switch_to_main_page(context):
context.browser.driver.switch_to.default_content()
2 changes: 0 additions & 2 deletions src/behaving/web/steps/tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@


def _process_table(table):

headers = [el.text for el in table.find_by_tag("th")]
# We should be using here rows = table.find_by_xpath("//tr[not(th)]")
# but for some reason this duplicates the rows.
Expand Down Expand Up @@ -68,7 +67,6 @@ def table_does_not_contain(context, selector):
table = _find_table_by_id_or_xpath(context, selector)
_, cells = _process_table(table)
for row in [*context.table.rows, context.table.headings]:

assert [cell for cell in row] not in cells, f"{row} found"


Expand Down

0 comments on commit c20f924

Please sign in to comment.