from __future__ import absolute_import, print_function
"""
Testing import statement with filefinder2
"""

import os
import sys
import unittest
import pytest  # we need to use pytest marker to get __package__ to get the proper value, making relative import works


# CAREFUL : it seems this does have side effect in pytest modules and hooks setup.
try:
    from ._utils import print_importers, xfail_py2_noff2, xfail_py2_noactive
except ValueError:  # "Attempted relative import in non-package" when running standalone
    from _utils import print_importers, xfail_py2_noff2, xfail_py2_noactive

# Because python 3.4 has issues with util.module_from_spec
#: expect failure if we are in python2 and did NOT import filefinder2
xfail_py34_noff2 = pytest.mark.xfail(  # we need a string there to access the config at runtime
    "(pytest.config.getoption('--noff2')) and sys.version_info < (3, 5)",
    reason="python 3.4 has issues with util.module_from_spec without importing filefinder2",
    strict=True
)

#: expect failure if we imported filefinder2 but did NOT activate it
xfail_py34_noactive = pytest.mark.xfail(  # we need a string there to access the config at runtime
    "(pytest.config.getoption('--noactive')) and sys.version_info < (3, 5)",