Rhet Turnbull 25d6f148be
CLI refactor (#642)
* Initial refactoring of cli.py

* Renamed cli_help

* Refactored all cli commands

* Dropped support for 3.7

* Added test for export with --min-size

* Version bump

* Fixed python version
2022-02-26 22:29:19 -08:00
..
2022-02-26 22:29:19 -08:00
2022-02-21 15:17:19 -08:00
2021-06-01 17:32:43 -07:00
2022-02-26 22:29:19 -08:00
2022-02-26 22:29:19 -08:00
2021-09-26 13:51:47 -07:00
2021-06-21 06:34:56 -07:00
2022-02-21 11:20:02 -08:00
2021-12-31 20:31:15 -08:00
2022-02-26 15:30:13 -08:00
2020-03-28 07:58:03 -07:00
2021-11-07 08:33:08 -08:00

Tests for osxphotos

Running Tests

To set up a dev environment to work on osxphotos code or run tests follow these steps. This assumes you have python 3.7 or later installed. If you need to install python, you can do so with the XCode command lines tools (xcode-select --install) or from python.org.

  • git clone git@github.com:RhetTbull/osxphotos.git
  • cd osxphotos
  • python3 -m venv venv
  • source venv/bin/activate
  • python3 -m pip install -r dev_requirements.txt
  • python3 -m pip install -e .

To run the tests, do the following from the main source folder: python3 -m pytest tests/

Skipped Tests

A few tests will look for certain environment variables to determine if they should run.

Some of the export tests rely on photos in my local library and will look for OSXPHOTOS_TEST_EXPORT=1 to determine if they should run.

One test for locale does not run on GitHub's automated workflow and will look for OSXPHOTOS_TEST_LOCALE=1 to determine if it should be run. If you want to run this test, set the environment variable.

Test Photo Libraries

Important: The test code uses several test photo libraries created on various version of MacOS. If you need to inspect one of these or modify one for a test, make a copy of the library (for example, copy it to your ~/Pictures folder) then open the copy in Photos. Once done, copy the revised library back to the tests/ folder. If you do not do this, the Photos background process photoanalysisd will forever try to process the library resulting in updates to the database which will cause git to see changes to the file you didn't intend. I'm not aware of any way to disassociate photoanalysisd from the library once you've opened it in Photos.

Attribution

These tests utilize a test Photos library. The test library is populated with photos from flickr and from my own photo library. All images used are licensed under Creative Commons 2.0 Attribution license.

Flickr images used from: