pytest_gee.plugin#

A pytest plugin to build a GEE environment for a test session.

Functions#

ee_dictionary_regression(datadir, original_datadir, ...)

Fixture to test ee.Dictionary objects.

ee_feature_collection_regression(datadir, ...)

Fixture to test ee.FeatureCollection objects.

ee_image_regression(datadir, original_datadir, request)

Fixture to test ee.Image objects.

ee_list_regression(datadir, original_datadir, request)

Fixture to test ee.List objects.

gee_folder_root()

Link to the root folder of the connected account.

gee_folder_structure()

The structure of the generated test folder.

gee_hash()

Generate a unique hash for the test session.

gee_test_folder(gee_hash, gee_folder_root, ...)

Create a test folder for the duration of the test session.

Module Contents#

pytest_gee.plugin.ee_dictionary_regression(datadir, original_datadir, request)[source]#

Fixture to test ee.Dictionary objects.

Parameters:
Returns:

The DictionaryFixture object.

Return type:

pytest_gee.dictionary_regression.DictionaryFixture

Example

def test_dictionary_regression(dictionary_regression):
    data = ee.Dictionary({"a": 1, "b": 2})
    dictionary_regression.check(data)
pytest_gee.plugin.ee_feature_collection_regression(datadir, original_datadir, request)[source]#

Fixture to test ee.FeatureCollection objects.

Parameters:
Returns:

The FeatureCollectionFixture object.

Return type:

pytest_gee.feature_collection_regression.FeatureCollectionFixture

Example

def test_feature_collection_regression(feature_collection_regression):
    data = ee.FeatureCollection("FAO/GAUL/2015/level0").filter(ee.Filter.eq("ADM0_NAME", "Holy See"))
    feature_collection_regression.check(data)
pytest_gee.plugin.ee_image_regression(datadir, original_datadir, request)[source]#

Fixture to test ee.Image objects.

Parameters:
Returns:

The ImageFixture object.

Return type:

pytest_gee.image_regression.ImageFixture

Example

def test_image_regression(image_regression):
    data = ee.Image("LANDSAT/LC08/C02/T1_L2/LC08_191031_20210514")
    image_regression.check(data, scale=1000)
pytest_gee.plugin.ee_list_regression(datadir, original_datadir, request)[source]#

Fixture to test ee.List objects.

Parameters:
Returns:

The ListFixture object.

Return type:

pytest_gee.list_regression.ListFixture

Example

def test_list_regression(list_regression):
    data = ee.List([1, 2, 3])
    list_regression.check(data)
pytest_gee.plugin.gee_folder_root()[source]#

Link to the root folder of the connected account.

pytest_gee.plugin.gee_folder_structure()[source]#

The structure of the generated test folder.

pytest_gee.plugin.gee_hash()[source]#

Generate a unique hash for the test session.

pytest_gee.plugin.gee_test_folder(gee_hash, gee_folder_root, gee_folder_structure)[source]#

Create a test folder for the duration of the test session.