Skip to content

Commit 302707b

Browse files
authored
Merge pull request #185 from radiantly/win-tests
test: fix tests on Windows
2 parents 34c6f1f + e9ed9b7 commit 302707b

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

.github/workflows/tests.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
name: PyDoll Tests
22

3-
on:
3+
on:
44
push:
55
pull_request:
6-
6+
77
jobs:
88
tests:
9-
runs-on: ubuntu-latest
109
strategy:
1110
fail-fast: false
1211
matrix:
12+
os: [ubuntu-latest, windows-latest]
1313
python-version: ["3.10", "3.11", "3.12", "3.13"]
14+
runs-on: ${{ matrix.os }}
1415
steps:
1516
- uses: actions/checkout@v3
1617
- name: Set up Python ${{ matrix.python-version }}

tests/test_browser/test_browser_tab.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -949,7 +949,7 @@ async def test_expect_file_chooser_event_handler_path_objects(self, tab):
949949
from pathlib import Path
950950

951951
files = [Path('documents/file1.txt'), Path('images/file2.jpg')]
952-
expected_files = ['documents/file1.txt', 'images/file2.jpg']
952+
expected_files = [str(file) for file in files]
953953

954954
await self._test_event_handler_with_files(tab, files, expected_files, 54321)
955955

@@ -959,7 +959,7 @@ async def test_expect_file_chooser_event_handler_single_path_object(self, tab):
959959
from pathlib import Path
960960

961961
files = Path('documents/important.pdf')
962-
expected_files = ['documents/important.pdf']
962+
expected_files = [str(files)]
963963

964964
await self._test_event_handler_with_files(tab, files, expected_files, 98765)
965965

tests/test_utils.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from aioresponses import aioresponses
44
import tempfile
55
import os
6+
import sys
67
from unittest.mock import patch
78

89
from pydoll import exceptions
@@ -189,6 +190,7 @@ def test_validate_browser_paths_no_valid_paths(self):
189190

190191
assert 'No valid browser path found in:' in str(exc_info.value)
191192

193+
@pytest.mark.skipif(sys.platform.startswith('win'), reason='No executable bit on NTFS on Windows')
192194
def test_validate_browser_paths_file_exists_but_not_executable(self):
193195
"""
194196
Test validate_browser_paths with non-executable file.
@@ -200,7 +202,7 @@ def test_validate_browser_paths_file_exists_but_not_executable(self):
200202
with open(non_executable, 'w') as f:
201203
f.write('not executable')
202204
# Don't set executable permissions
203-
205+
204206
with pytest.raises(exceptions.InvalidBrowserPath):
205207
validate_browser_paths([non_executable])
206208

0 commit comments

Comments
 (0)