Skip to content

Commit

Permalink
Merge pull request #32 from jacebrowning/nest-sites
Browse files Browse the repository at this point in the history
Nest sites directory under client package
  • Loading branch information
jacebrowning committed Jun 29, 2020
2 parents 9181a15 + d8ecfe1 commit 84136b4
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 5 deletions.
6 changes: 3 additions & 3 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions pomace/api.py
@@ -1,4 +1,7 @@
import atexit
import inspect
import os
from pathlib import Path
from typing import Optional

import log
Expand Down Expand Up @@ -31,6 +34,10 @@ def visit(
log.silence('urllib3.connectionpool')
atexit.register(utils.quit_browser, silence_logging=True)

frame = inspect.getouterframes(inspect.currentframe())[1]
path = Path(frame.filename)
os.chdir(path.parent)

return models.autopage()


Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
@@ -1,7 +1,7 @@
[tool.poetry]

name = "pomace"
version = "0.0.15"
version = "0.0.16"
description = "Dynamic page objects for browser automation."

license = "MIT"
Expand Down
9 changes: 8 additions & 1 deletion tests/test_api.py
@@ -1,4 +1,6 @@
# pylint: disable=unused-variable
# pylint: disable=unused-variable,expression-not-assigned

from pathlib import Path

import pomace

Expand All @@ -7,3 +9,8 @@ def describe_visit():
def it_launches_a_browser(expect):
page = pomace.visit("http://example.com", browser='chrome', headless=True)
expect(page).contains("Example Domain")

def it_saves_data_relative_caller(expect):
page = pomace.visit("http://example.com", browser='chrome', headless=True)
path = Path(__file__).parent / 'sites' / 'example.com' / '@' / 'default.yml'
expect(page.datafile.path) == path.resolve()

0 comments on commit 84136b4

Please sign in to comment.