-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
121 changed files
with
1,254 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Running the test suite | ||
|
||
The tests use pytest so: | ||
|
||
`python3 -m pip install pytest` | ||
`python -m pytest` | ||
|
||
In order to properly test PhotoScript, the test suite must obviously interact with Photos using AppleScript. This requires some user input so the test suite **must** be run with user interaction; it cannot be run in "headless" manner. | ||
|
||
When the test suite is run, pytest will first copy a test library to the user's ~/Pictures folder (overwriting the existing test library if it is present) then tell Photos to open this library. This may require user interaction to confirm opening the library. | ||
|
||
Some of the tests will pause an wait for the user to do something. These tests will prompt the user and tell them what to do (e.g. select photos in Photos). | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import pytest | ||
|
||
import shutil | ||
from applescript import AppleScript | ||
import os | ||
import pathlib | ||
|
||
TEST_LIBRARY = "Test-PhotoScript-10.15.6.photoslibrary" | ||
|
||
|
||
@pytest.fixture(scope="session") | ||
def photo_library(): | ||
""" copy the test library and open Photos """ | ||
script = AppleScript( | ||
""" | ||
tell application "Photos" | ||
quit | ||
end tell | ||
""" | ||
) | ||
script.run() | ||
src = pathlib.Path(os.getcwd()) / f"tests/test_libraries/{TEST_LIBRARY}" | ||
dest = os.path.expanduser(f"~/Pictures") | ||
library = shutil.copytree(src, dest, dirs_exist_ok=True) | ||
script = AppleScript( | ||
f""" | ||
set tries to 0 | ||
repeat while tries < 5 | ||
try | ||
tell application "Photos" | ||
activate | ||
delay 5 | ||
open POSIX file "{library}" | ||
end tell | ||
set tries to 5 | ||
on error | ||
set tries to tries + 1 | ||
end try | ||
end repeat | ||
""" | ||
) | ||
script.run() | ||
return library | ||
|
||
@pytest.fixture | ||
def suspend_capture(pytestconfig): | ||
class suspend_guard: | ||
def __init__(self): | ||
self.capmanager = pytestconfig.pluginmanager.getplugin('capturemanager') | ||
def __enter__(self): | ||
self.capmanager.suspend_global_capture(in_=True) | ||
def __exit__(self, _1, _2, _3): | ||
self.capmanager.resume_global_capture() | ||
|
||
yield suspend_guard() |
This file was deleted.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions
10
tests/test_libraries/Test-PhotoScript-10.15.6.photoslibrary/database/DataModelVersion.plist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>LibrarySchemaVersion</key> | ||
<integer>5001</integer> | ||
<key>MetaSchemaVersion</key> | ||
<integer>3</integer> | ||
</dict> | ||
</plist> |
Binary file added
BIN
+1.6 MB
tests/test_libraries/Test-PhotoScript-10.15.6.photoslibrary/database/Photos.sqlite
Binary file not shown.
Binary file added
BIN
+32 KB
tests/test_libraries/Test-PhotoScript-10.15.6.photoslibrary/database/Photos.sqlite-shm
Binary file not shown.
Binary file added
BIN
+1.79 MB
tests/test_libraries/Test-PhotoScript-10.15.6.photoslibrary/database/Photos.sqlite-wal
Binary file not shown.
16 changes: 16 additions & 0 deletions
16
tests/test_libraries/Test-PhotoScript-10.15.6.photoslibrary/database/Photos.sqlite.lock
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>hostname</key> | ||
<string>Rhets-MacBook-Pro.local</string> | ||
<key>hostuuid</key> | ||
<string>9575E48B-8D5F-5654-ABAC-4431B1167324</string> | ||
<key>pid</key> | ||
<integer>3175</integer> | ||
<key>processname</key> | ||
<string>photolibraryd</string> | ||
<key>uid</key> | ||
<integer>501</integer> | ||
</dict> | ||
</plist> |
Binary file added
BIN
+48 KB
tests/test_libraries/Test-PhotoScript-10.15.6.photoslibrary/database/metaSchema.db
Binary file not shown.
Binary file added
BIN
+48 KB
tests/test_libraries/Test-PhotoScript-10.15.6.photoslibrary/database/photos.db
Binary file not shown.
Empty file.
Binary file added
BIN
+261 Bytes
..._libraries/Test-PhotoScript-10.15.6.photoslibrary/database/search/graphDataProgress.plist
Binary file not shown.
Binary file added
BIN
+120 KB
tests/test_libraries/Test-PhotoScript-10.15.6.photoslibrary/database/search/psi.sqlite
Binary file not shown.
Binary file added
BIN
+32 KB
tests/test_libraries/Test-PhotoScript-10.15.6.photoslibrary/database/search/psi.sqlite-shm
Binary file not shown.
Empty file.
186 changes: 186 additions & 0 deletions
186
...est_libraries/Test-PhotoScript-10.15.6.photoslibrary/database/search/searchMetadata.plist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,186 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>BlacklistedMeaningsByMeaning</key> | ||
<dict/> | ||
<key>SceneWhitelist</key> | ||
<array> | ||
<string>Graduation</string> | ||
<string>Aquarium</string> | ||
<string>Food</string> | ||
<string>Ice Skating</string> | ||
<string>Mountain</string> | ||
<string>Cliff</string> | ||
<string>Basketball</string> | ||
<string>Tennis</string> | ||
<string>Jewelry</string> | ||
<string>Cheese</string> | ||
<string>Softball</string> | ||
<string>Football</string> | ||
<string>Circus</string> | ||
<string>Jet Ski</string> | ||
<string>Playground</string> | ||
<string>Carousel</string> | ||
<string>Paint Ball</string> | ||
<string>Windsurfing</string> | ||
<string>Sailboat</string> | ||
<string>Sunbathing</string> | ||
<string>Dam</string> | ||
<string>Fireplace</string> | ||
<string>Flower</string> | ||
<string>Scuba</string> | ||
<string>Hiking</string> | ||
<string>Cetacean</string> | ||
<string>Pier</string> | ||
<string>Bowling</string> | ||
<string>Snowboarding</string> | ||
<string>Zoo</string> | ||
<string>Snowmobile</string> | ||
<string>Theater</string> | ||
<string>Boat</string> | ||
<string>Casino</string> | ||
<string>Car</string> | ||
<string>Diving</string> | ||
<string>Cycling</string> | ||
<string>Musical Instrument</string> | ||
<string>Board Game</string> | ||
<string>Castle</string> | ||
<string>Sunset Sunrise</string> | ||
<string>Martial Arts</string> | ||
<string>Motocross</string> | ||
<string>Submarine</string> | ||
<string>Cat</string> | ||
<string>Snow</string> | ||
<string>Kiteboarding</string> | ||
<string>Squash</string> | ||
<string>Geyser</string> | ||
<string>Music</string> | ||
<string>Archery</string> | ||
<string>Desert</string> | ||
<string>Blackjack</string> | ||
<string>Fireworks</string> | ||
<string>Sportscar</string> | ||
<string>Feline</string> | ||
<string>Soccer</string> | ||
<string>Museum</string> | ||
<string>Baby</string> | ||
<string>Fencing</string> | ||
<string>Railroad</string> | ||
<string>Nascar</string> | ||
<string>Sky Surfing</string> | ||
<string>Bird</string> | ||
<string>Games</string> | ||
<string>Baseball</string> | ||
<string>Dressage</string> | ||
<string>Snorkeling</string> | ||
<string>Pyramid</string> | ||
<string>Kite</string> | ||
<string>Rowboat</string> | ||
<string>Golf</string> | ||
<string>Watersports</string> | ||
<string>Lightning</string> | ||
<string>Canyon</string> | ||
<string>Auditorium</string> | ||
<string>Night Sky</string> | ||
<string>Karaoke</string> | ||
<string>Skiing</string> | ||
<string>Parade</string> | ||
<string>Forest</string> | ||
<string>Hot Air Balloon</string> | ||
<string>Dragon Parade</string> | ||
<string>Easter Egg</string> | ||
<string>Monument</string> | ||
<string>Jungle</string> | ||
<string>Thanksgiving</string> | ||
<string>Jockey Horse</string> | ||
<string>Stadium</string> | ||
<string>Airplane</string> | ||
<string>Ballet</string> | ||
<string>Yoga</string> | ||
<string>Coral Reef</string> | ||
<string>Skating</string> | ||
<string>Wrestling</string> | ||
<string>Bicycle</string> | ||
<string>Tattoo</string> | ||
<string>Amusement Park</string> | ||
<string>Canoe</string> | ||
<string>Cheerleading</string> | ||
<string>Ping Pong</string> | ||
<string>Fishing</string> | ||
<string>Magic</string> | ||
<string>Reptile</string> | ||
<string>Winter Sport</string> | ||
<string>Waterfall</string> | ||
<string>Train</string> | ||
<string>Bonsai</string> | ||
<string>Surfing</string> | ||
<string>Dog</string> | ||
<string>Cake</string> | ||
<string>Sledding</string> | ||
<string>Sandcastle</string> | ||
<string>Glacier</string> | ||
<string>Lighthouse</string> | ||
<string>Equestrian</string> | ||
<string>Rafting</string> | ||
<string>Shore</string> | ||
<string>Hockey</string> | ||
<string>Santa Claus</string> | ||
<string>Formula One Car</string> | ||
<string>Sport</string> | ||
<string>Vehicle</string> | ||
<string>Boxing</string> | ||
<string>Rollerskating</string> | ||
<string>Underwater</string> | ||
<string>Orchestra</string> | ||
<string>Carnival</string> | ||
<string>Rocket</string> | ||
<string>Skateboarding</string> | ||
<string>Helicopter</string> | ||
<string>Performance</string> | ||
<string>Oktoberfest</string> | ||
<string>Water Polo</string> | ||
<string>Skate Park</string> | ||
<string>Animal</string> | ||
<string>Nightclub</string> | ||
<string>String Instrument</string> | ||
<string>Dinosaur</string> | ||
<string>Gymnastics</string> | ||
<string>Cricket</string> | ||
<string>Volcano</string> | ||
<string>Lake</string> | ||
<string>Aurora</string> | ||
<string>Dancing</string> | ||
<string>Concert</string> | ||
<string>Rock Climbing</string> | ||
<string>Hang Glider</string> | ||
<string>Rodeo</string> | ||
<string>Fish</string> | ||
<string>Art</string> | ||
<string>Motorcycle</string> | ||
<string>Volleyball</string> | ||
<string>Wake Boarding</string> | ||
<string>Badminton</string> | ||
<string>Motor Sport</string> | ||
<string>Sumo</string> | ||
<string>Parasailing</string> | ||
<string>Skydiving</string> | ||
<string>Kickboxing</string> | ||
<string>Pinata</string> | ||
<string>Foosball</string> | ||
<string>Go Kart</string> | ||
<string>Poker</string> | ||
<string>Kayak</string> | ||
<string>Swimming</string> | ||
<string>Atv</string> | ||
<string>Beach</string> | ||
<string>Dartboard</string> | ||
<string>Athletics</string> | ||
<string>Camping</string> | ||
<string>Tornado</string> | ||
<string>Billiards</string> | ||
<string>Rugby</string> | ||
<string>Airshow</string> | ||
</array> | ||
</dict> | ||
</plist> |
26 changes: 26 additions & 0 deletions
26
...est_libraries/Test-PhotoScript-10.15.6.photoslibrary/database/search/searchProgress.plist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>insertAlbum</key> | ||
<array/> | ||
<key>insertAsset</key> | ||
<array/> | ||
<key>insertHighlight</key> | ||
<array/> | ||
<key>insertMemory</key> | ||
<array/> | ||
<key>insertMoment</key> | ||
<array/> | ||
<key>removeAlbum</key> | ||
<array/> | ||
<key>removeAsset</key> | ||
<array/> | ||
<key>removeHighlight</key> | ||
<array/> | ||
<key>removeMemory</key> | ||
<array/> | ||
<key>removeMoment</key> | ||
<array/> | ||
</dict> | ||
</plist> |
14 changes: 14 additions & 0 deletions
14
...t_libraries/Test-PhotoScript-10.15.6.photoslibrary/database/search/searchSystemInfo.plist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>embeddingVersion</key> | ||
<string>1</string> | ||
<key>localeIdentifier</key> | ||
<string>en_US</string> | ||
<key>sceneTaxonomySHA</key> | ||
<string>87914a047c69fbe8013fad2c70fa70c6c03b08b56190fe4054c880e6b9f57cc3</string> | ||
<key>searchIndexVersion</key> | ||
<string>10</string> | ||
</dict> | ||
</plist> |
Binary file added
BIN
+890 Bytes
...st_libraries/Test-PhotoScript-10.15.6.photoslibrary/database/search/synonymsProcess.plist
Binary file not shown.
Binary file added
BIN
+2.81 KB
...s/test_libraries/Test-PhotoScript-10.15.6.photoslibrary/database/search/zeroKeywords.data
Binary file not shown.
Binary file added
BIN
+3.44 MB
...ipt-10.15.6.photoslibrary/originals/1/1CD1B172-C94B-4093-A303-EE24FE7EEF60.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+127 KB
...ipt-10.15.6.photoslibrary/originals/3/3A71DE26-EDEF-41D3-86C1-E8328DFC9FA0.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.92 MB
...ipt-10.15.6.photoslibrary/originals/B/B6DB996D-8A0A-4983-AFBD-D206B7D38A23.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.32 MB
...ipt-10.15.6.photoslibrary/originals/E/EECD91FE-D716-48F2-A62C-A4D558ACD52E.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.69 MB
...ipt-10.15.6.photoslibrary/originals/F/F8EFA39F-7D26-4DC2-82FE-CC9357F19F00.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.