Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update (testing) dependcies #96

Merged
merged 5 commits into from
Dec 29, 2024
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
2 changes: 1 addition & 1 deletion .github/workflows/pcloud-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.8, 3.9, "3.10", "3.11", "3.12"]
python-version: [3.9, "3.10", "3.11", "3.12", "3.13"]
max-parallel: 1
steps:
- uses: actions/checkout@v4
Expand Down
4 changes: 3 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ Changelog
1.4 (unreleased)
----------------

- Nothing changed yet.
- Update (testing) dependencies [tomgross]
- Run tests on Python 3.9-3.13 [tomgross]
- Allow `eapi` with fs.opener #85 [tomgross]


1.3 (2024-03-01)
Expand Down
10 changes: 7 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@
"Environment :: Other Environment",
"Environment :: Web Environment",
"Programming Language :: Python",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Operating System :: OS Independent",
"License :: OSI Approved :: MIT License",
"Topic :: Software Development :: Libraries :: Python Modules",
Expand All @@ -48,10 +48,14 @@
install_requires=[
"requests",
"requests-toolbelt",
"setuptools>=70.3.0"
"wheel>=0.45.1",
"setuptools>=75.6.0"
],
extras_require={"pyfs": ["fs"]},
entry_points={
"fs.opener": ["pcloud = pcloud.pcloudfs:PCloudOpener"],
"fs.opener": [
"pcloud = pcloud.pcloudfs:PCloudOpener",
"pcloud+eapi = pcloud.pcloudfs:PCloudOpener",
],
},
)
11 changes: 9 additions & 2 deletions src/pcloud/pcloudfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -392,12 +392,19 @@ def removetree(self, dir_path):


class PCloudOpener(Opener):
protocols = ["pcloud"]
protocols = ["pcloud", "pcloud+eapi"]

@staticmethod
def open_fs(fs_url, parse_result, writeable, create, cwd):
_, _, directory = parse_result.resource.partition("/")
fs = PCloudFS(username=parse_result.username, password=parse_result.password)
endpoint = "api"
if "+" in parse_result.protocol:
_, endpoint = parse_result.protocol.split("+")
fs = PCloudFS(
username=parse_result.username,
password=parse_result.password,
endpoint=endpoint,
)
if directory:
return fs.opendir(directory)
else:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ class PlaywrightTokenHandler(TokenHandler):

def open_browser(self):
with sync_playwright() as p:
self.browser = p.firefox.launch()
# set headless to `False` for debugging purposes
self.browser = p.firefox.launch(headless=True)
self.browser.new_context(
locale="de-DE",
timezone_id="Europe/Berlin",
Expand Down
11 changes: 11 additions & 0 deletions src/pcloud/tests/test_pyfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@

from fs import errors
from fs.test import FSTestCases
from fs import opener
from pcloud.pcloudfs import PCloudFS
from urllib.parse import quote


class TestpCloudFS(FSTestCases, unittest.TestCase):

@classmethod
def setUpClass(cls):
username = os.environ.get("PCLOUD_USERNAME")
Expand Down Expand Up @@ -68,3 +71,11 @@ def test_remove(self):
error_msg = "resource 'foo/bar/egg/test.txt' not found"
with self.assertRaisesRegex(errors.ResourceNotFound, error_msg):
self.fs.remove("foo/bar/egg/test.txt")

# Test custom functionality

def test_fs_opener(self):
username = quote(os.environ.get("PCLOUD_USERNAME"))
password = os.environ.get("PCLOUD_PASSWORD")
with opener.open_fs(f"pcloud+eapi://{username}:{password}@/") as pcloud_fs:
assert pcloud_fs.pcloud.endpoint == "https://eapi.pcloud.com/"
19 changes: 10 additions & 9 deletions test_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
pytest==7.4.4
pytest==8.3.4
pytest-sugar==1.0.0
pytest-timeout==2.2.0
pytest-cov==4.1.0
pytest-rerunfailures==13.0
wheel==0.42.0
flake8==7.0.0
pytest-timeout==2.3.1
pytest-cov==6.0.0
pytest-rerunfailures==15.0
wheel==0.45.1
flake8==7.1.1
fs==2.4.16
playwright==1.41.2
multipart==0.2.4
setuptools>=65.5.1 # not directly required, pinned by Snyk to avoid a vulnerability
playwright==1.49.1
multipart==1.2.1
setuptools>=75.6.0 # not directly required, pinned by Snyk to avoid a vulnerability
zipp>=3.19.1 # not directly required, pinned by Snyk to avoid a vulnerability
Loading