# which may not have XATTR support (e.g. tmpfs); # manual override here. TESTDIR = None if request.param == "file": tempfile = NamedTemporaryFile(dir=TESTDIR) tempfilename = tempfile.name yield tempfilename tempfile.close() else: tempdir = TemporaryDirectory(dir=TESTDIR) tempdirname = tempdir.name yield tempdirname tempdir.cleanup() test_data = [(attr) for attr in sorted(list(ATTRIBUTES.keys())) if ATTRIBUTES[attr].class_ == _AttributeList and ATTRIBUTES[attr].type_ == str] ids = [ attr for attr in sorted(list(ATTRIBUTES.keys())) if ATTRIBUTES[attr].class_ == _AttributeList and ATTRIBUTES[attr].type_ == str ] test_data2 = [(attribute_name) for attribute_name in { ATTRIBUTES[attr].name for attr in sorted(ATTRIBUTES) if ATTRIBUTES[attr].class_ == _AttributeList and ATTRIBUTES[attr].type_ == str }] ids2 = [ attribute_name for attribute_name in { ATTRIBUTES[attr].name
#!/usr/bin/env python import datetime from tempfile import NamedTemporaryFile import pytest from click.testing import CliRunner from osxmetadata.attributes import ATTRIBUTES from osxmetadata.classes import _AttributeList, _AttributeTagsList # get list attribute names for string attributes for parameterized testing test_names_str = [ (attr) for attr in sorted(list(ATTRIBUTES.keys())) if ATTRIBUTES[attr].class_ == str ] ids_str = [ attr for attr in sorted(list(ATTRIBUTES.keys())) if ATTRIBUTES[attr].class_ == str ] # list of list attributes of type str test_names_list = [ (attr) for attr in sorted(list(ATTRIBUTES.keys())) if ATTRIBUTES[attr].class_ in (_AttributeList, _AttributeTagsList) and ATTRIBUTES[attr].type_ == str ] ids_list = [ attr for attr in sorted(list(ATTRIBUTES.keys())) if ATTRIBUTES[attr].class_ in (_AttributeList, _AttributeTagsList) and ATTRIBUTES[attr].type_ == str
TESTDIR = None if request.param == "file": tempfile = NamedTemporaryFile(dir=TESTDIR) tempfilename = tempfile.name yield tempfilename tempfile.close() else: tempdir = TemporaryDirectory(dir=TESTDIR) tempdirname = tempdir.name yield tempdirname tempdir.cleanup() test_data = [ (attr) for attr in sorted(list(ATTRIBUTES.keys())) if ATTRIBUTES[attr].class_ == datetime.datetime ] ids = [ attr for attr in sorted(list(ATTRIBUTES.keys())) if ATTRIBUTES[attr].class_ == datetime.datetime ] test_data2 = [ (attribute_name) for attribute_name in { ATTRIBUTES[attr].name for attr in sorted(ATTRIBUTES) if ATTRIBUTES[attr].class_ == datetime.datetime }
""" Test osxmetadata command line interface """ import datetime from tempfile import NamedTemporaryFile, TemporaryDirectory import pytest from click.testing import CliRunner from osxmetadata.attributes import ATTRIBUTES from osxmetadata.classes import _AttributeList, _AttributeTagsList # get list attribute names for string attributes for parameterized testing test_names_str = [(attr) for attr in sorted(list(ATTRIBUTES.keys())) if ATTRIBUTES[attr].class_ == str] ids_str = [ attr for attr in sorted(list(ATTRIBUTES.keys())) if ATTRIBUTES[attr].class_ == str ] # list of list attributes of type str test_names_list = [ (attr) for attr in sorted(list(ATTRIBUTES.keys())) if ATTRIBUTES[attr].class_ in ( _AttributeList, _AttributeTagsList) and ATTRIBUTES[attr].type_ == str ] ids_list = [ attr for attr in sorted(list(ATTRIBUTES.keys())) if ATTRIBUTES[attr].class_ in ( _AttributeList, _AttributeTagsList) and ATTRIBUTES[attr].type_ == str ]