Updated tests and docs

This commit is contained in:
Rhet Turnbull
2021-12-31 20:31:15 -08:00
parent a3b2784f31
commit 1391675a3a
11 changed files with 42 additions and 16 deletions

View File

@@ -1721,7 +1721,7 @@ Substitution Description
{lf} A line feed: '\n', alias for {newline} {lf} A line feed: '\n', alias for {newline}
{cr} A carriage return: '\r' {cr} A carriage return: '\r'
{crlf} a carriage return + line feed: '\r\n' {crlf} a carriage return + line feed: '\r\n'
{osxphotos_version} The osxphotos version, e.g. '0.44.2' {osxphotos_version} The osxphotos version, e.g. '0.44.3'
{osxphotos_cmd_line} The full command line used to run osxphotos {osxphotos_cmd_line} The full command line used to run osxphotos
The following substitutions may result in multiple values. Thus if specified for The following substitutions may result in multiple values. Thus if specified for
@@ -3623,7 +3623,7 @@ The following template field substitutions are availabe for use the templating s
|{lf}|A line feed: '\n', alias for {newline}| |{lf}|A line feed: '\n', alias for {newline}|
|{cr}|A carriage return: '\r'| |{cr}|A carriage return: '\r'|
|{crlf}|a carriage return + line feed: '\r\n'| |{crlf}|a carriage return + line feed: '\r\n'|
|{osxphotos_version}|The osxphotos version, e.g. '0.44.2'| |{osxphotos_version}|The osxphotos version, e.g. '0.44.3'|
|{osxphotos_cmd_line}|The full command line used to run osxphotos| |{osxphotos_cmd_line}|The full command line used to run osxphotos|
|{album}|Album(s) photo is contained in| |{album}|Album(s) photo is contained in|
|{folder_album}|Folder path + album photo is contained in. e.g. 'Folder/Subfolder/Album' or just 'Album' if no enclosing folder| |{folder_album}|Folder path + album photo is contained in. e.g. 'Folder/Subfolder/Album' or just 'Album' if no enclosing folder|

View File

@@ -1,4 +1,4 @@
# Sphinx build info version 1 # Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. # This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config: 0e07227cf12d615535745e76d515a89c config: 8dc04ce2ac089dfa0c5fc3a14c14ed6e
tags: 645f666f9bcd5a90fca523b33c5a78b7 tags: 645f666f9bcd5a90fca523b33c5a78b7

View File

@@ -1,6 +1,6 @@
var DOCUMENTATION_OPTIONS = { var DOCUMENTATION_OPTIONS = {
URL_ROOT: document.getElementById("documentation_options").getAttribute('data-url_root'), URL_ROOT: document.getElementById("documentation_options").getAttribute('data-url_root'),
VERSION: '0.44.2', VERSION: '0.44.3',
LANGUAGE: 'None', LANGUAGE: 'None',
COLLAPSE_INDEX: false, COLLAPSE_INDEX: false,
BUILDER: 'html', BUILDER: 'html',

View File

@@ -6,7 +6,7 @@
<meta charset="utf-8" /> <meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
<title>osxphotos command line interface (CLI) &#8212; osxphotos 0.44.2 documentation</title> <title>osxphotos command line interface (CLI) &#8212; osxphotos 0.44.3 documentation</title>
<link rel="stylesheet" type="text/css" href="_static/pygments.css" /> <link rel="stylesheet" type="text/css" href="_static/pygments.css" />
<link rel="stylesheet" type="text/css" href="_static/alabaster.css" /> <link rel="stylesheet" type="text/css" href="_static/alabaster.css" />
<script data-url_root="./" id="documentation_options" src="_static/documentation_options.js"></script> <script data-url_root="./" id="documentation_options" src="_static/documentation_options.js"></script>

View File

@@ -5,7 +5,7 @@
<head> <head>
<meta charset="utf-8" /> <meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Index &#8212; osxphotos 0.44.2 documentation</title> <title>Index &#8212; osxphotos 0.44.3 documentation</title>
<link rel="stylesheet" type="text/css" href="_static/pygments.css" /> <link rel="stylesheet" type="text/css" href="_static/pygments.css" />
<link rel="stylesheet" type="text/css" href="_static/alabaster.css" /> <link rel="stylesheet" type="text/css" href="_static/alabaster.css" />
<script data-url_root="./" id="documentation_options" src="_static/documentation_options.js"></script> <script data-url_root="./" id="documentation_options" src="_static/documentation_options.js"></script>

View File

@@ -6,7 +6,7 @@
<meta charset="utf-8" /> <meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
<title>Welcome to osxphotoss documentation! &#8212; osxphotos 0.44.2 documentation</title> <title>Welcome to osxphotoss documentation! &#8212; osxphotos 0.44.3 documentation</title>
<link rel="stylesheet" type="text/css" href="_static/pygments.css" /> <link rel="stylesheet" type="text/css" href="_static/pygments.css" />
<link rel="stylesheet" type="text/css" href="_static/alabaster.css" /> <link rel="stylesheet" type="text/css" href="_static/alabaster.css" />
<script data-url_root="./" id="documentation_options" src="_static/documentation_options.js"></script> <script data-url_root="./" id="documentation_options" src="_static/documentation_options.js"></script>

View File

@@ -6,7 +6,7 @@
<meta charset="utf-8" /> <meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
<title>osxphotos &#8212; osxphotos 0.44.2 documentation</title> <title>osxphotos &#8212; osxphotos 0.44.3 documentation</title>
<link rel="stylesheet" type="text/css" href="_static/pygments.css" /> <link rel="stylesheet" type="text/css" href="_static/pygments.css" />
<link rel="stylesheet" type="text/css" href="_static/alabaster.css" /> <link rel="stylesheet" type="text/css" href="_static/alabaster.css" />
<script data-url_root="./" id="documentation_options" src="_static/documentation_options.js"></script> <script data-url_root="./" id="documentation_options" src="_static/documentation_options.js"></script>

View File

@@ -6,7 +6,7 @@
<meta charset="utf-8" /> <meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
<title>osxphotos package &#8212; osxphotos 0.44.2 documentation</title> <title>osxphotos package &#8212; osxphotos 0.44.3 documentation</title>
<link rel="stylesheet" type="text/css" href="_static/pygments.css" /> <link rel="stylesheet" type="text/css" href="_static/pygments.css" />
<link rel="stylesheet" type="text/css" href="_static/alabaster.css" /> <link rel="stylesheet" type="text/css" href="_static/alabaster.css" />
<script data-url_root="./" id="documentation_options" src="_static/documentation_options.js"></script> <script data-url_root="./" id="documentation_options" src="_static/documentation_options.js"></script>

View File

@@ -5,7 +5,7 @@
<head> <head>
<meta charset="utf-8" /> <meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Search &#8212; osxphotos 0.44.2 documentation</title> <title>Search &#8212; osxphotos 0.44.3 documentation</title>
<link rel="stylesheet" type="text/css" href="_static/pygments.css" /> <link rel="stylesheet" type="text/css" href="_static/pygments.css" />
<link rel="stylesheet" type="text/css" href="_static/alabaster.css" /> <link rel="stylesheet" type="text/css" href="_static/alabaster.css" />

View File

@@ -2393,6 +2393,10 @@ def test_export_original_suffix_template():
assert sorted(files) == sorted(CLI_EXPORT_FILENAMES_ORIGINAL_SUFFIX_TEMPLATE) assert sorted(files) == sorted(CLI_EXPORT_FILENAMES_ORIGINAL_SUFFIX_TEMPLATE)
@pytest.mark.skipif(
"OSXPHOTOS_TEST_CONVERT" not in os.environ,
reason="Skip if running in Github actions, no GPU.",
)
def test_export_convert_to_jpeg(): def test_export_convert_to_jpeg():
"""test --convert-to-jpeg""" """test --convert-to-jpeg"""
import glob import glob
@@ -2416,6 +2420,10 @@ def test_export_convert_to_jpeg():
assert large_file.stat().st_size > 7000000 assert large_file.stat().st_size > 7000000
@pytest.mark.skipif(
"OSXPHOTOS_TEST_CONVERT" not in os.environ,
reason="Skip if running in Github actions, no GPU.",
)
def test_export_convert_to_jpeg_quality(): def test_export_convert_to_jpeg_quality():
"""test --convert-to-jpeg --jpeg-quality""" """test --convert-to-jpeg --jpeg-quality"""
import glob import glob
@@ -2447,6 +2455,10 @@ def test_export_convert_to_jpeg_quality():
assert large_file.stat().st_size < 1000000 assert large_file.stat().st_size < 1000000
@pytest.mark.skipif(
"OSXPHOTOS_TEST_CONVERT" not in os.environ,
reason="Skip if running in Github actions, no GPU.",
)
def test_export_convert_to_jpeg_skip_raw(): def test_export_convert_to_jpeg_skip_raw():
"""test --convert-to-jpeg""" """test --convert-to-jpeg"""
import glob import glob
@@ -6666,6 +6678,10 @@ def test_export_jpeg_ext_edited_movie():
assert f"{filename}_edited.{ext}".lower() in files assert f"{filename}_edited.{ext}".lower() in files
@pytest.mark.skipif(
"OSXPHOTOS_TEST_CONVERT" not in os.environ,
reason="Skip if running in Github actions, no GPU.",
)
def test_export_jpeg_ext_convert_to_jpeg(): def test_export_jpeg_ext_convert_to_jpeg():
"""test --jpeg-ext with --convert-to-jpeg""" """test --jpeg-ext with --convert-to-jpeg"""
import glob import glob
@@ -6697,6 +6713,10 @@ def test_export_jpeg_ext_convert_to_jpeg():
assert f"{filename}.jpg" in files assert f"{filename}.jpg" in files
@pytest.mark.skipif(
"OSXPHOTOS_TEST_CONVERT" not in os.environ,
reason="Skip if running in Github actions, no GPU.",
)
def test_export_jpeg_ext_convert_to_jpeg_movie(): def test_export_jpeg_ext_convert_to_jpeg_movie():
"""test --jpeg-ext with --convert-to-jpeg and a movie, shouldn't convert or change extensions, #366""" """test --jpeg-ext with --convert-to-jpeg and a movie, shouldn't convert or change extensions, #366"""
import glob import glob

View File

@@ -4,6 +4,11 @@ import os
import pytest import pytest
skip_test = "OSXPHOTOS_TEST_CONVERT" not in os.environ
pytestmark = pytest.mark.skipif(
skip_test, reason="Skip if running on GitHub actions, no GPU."
)
TEST_HEIC = "tests/test-images/IMG_3092.heic" TEST_HEIC = "tests/test-images/IMG_3092.heic"
TEST_RAW = "tests/test-images/IMG_0476_2.CR2" TEST_RAW = "tests/test-images/IMG_0476_2.CR2"
@@ -14,7 +19,7 @@ TEST_IMAGE_DOES_NOT_EXIST = "tests/test-images/NOT-A-FILE.heic"
def test_image_converter_singleton(): def test_image_converter_singleton():
"""test that ImageConverter is a singleton""" """ test that ImageConverter is a singleton """
from osxphotos.imageconverter import ImageConverter from osxphotos.imageconverter import ImageConverter
convert1 = ImageConverter() convert1 = ImageConverter()
@@ -24,7 +29,7 @@ def test_image_converter_singleton():
def test_image_converter(): def test_image_converter():
"""test conversion of different image types""" """ test conversion of different image types """
import pathlib import pathlib
import tempfile import tempfile
from osxphotos.imageconverter import ImageConverter from osxphotos.imageconverter import ImageConverter
@@ -45,7 +50,7 @@ def test_image_converter():
def test_image_converter_compression_quality(): def test_image_converter_compression_quality():
"""test conversion of different image types with custom compression quality""" """ test conversion of different image types with custom compression quality """
import pathlib import pathlib
import tempfile import tempfile
from osxphotos.imageconverter import ImageConverter from osxphotos.imageconverter import ImageConverter
@@ -64,7 +69,7 @@ def test_image_converter_compression_quality():
def test_image_converter_bad_compression_quality(): def test_image_converter_bad_compression_quality():
"""test illegal compression quality""" """ test illegal compression quality """
import pathlib import pathlib
import tempfile import tempfile
from osxphotos.imageconverter import ImageConverter from osxphotos.imageconverter import ImageConverter
@@ -81,7 +86,7 @@ def test_image_converter_bad_compression_quality():
def test_image_converter_bad_file(): def test_image_converter_bad_file():
"""Try to convert a file that's not an image""" """ Try to convert a file that's not an image """
import pathlib import pathlib
import tempfile import tempfile
from osxphotos.imageconverter import ImageConverter, ImageConversionError from osxphotos.imageconverter import ImageConverter, ImageConversionError
@@ -96,7 +101,7 @@ def test_image_converter_bad_file():
def test_image_converter_missing_file(): def test_image_converter_missing_file():
"""Try to convert a file that's not an image""" """ Try to convert a file that's not an image """
import pathlib import pathlib
import tempfile import tempfile
from osxphotos.imageconverter import ImageConverter from osxphotos.imageconverter import ImageConverter
@@ -108,3 +113,4 @@ def test_image_converter_missing_file():
outfile = pathlib.Path(tempdir.name) / f"{imgfile.stem}.jpeg" outfile = pathlib.Path(tempdir.name) / f"{imgfile.stem}.jpeg"
with pytest.raises(FileNotFoundError): with pytest.raises(FileNotFoundError):
converter.write_jpeg(imgfile, outfile) converter.write_jpeg(imgfile, outfile)