#  tests for cython-0.29.25-py38hbcddfd3_0 (this is a generated file);
print('===== testing package: cython-0.29.25-py38hbcddfd3_0 =====');
print('running run_test.py');
#  --- run_test.py (begin) ---
import Cython
import Cython.Compiler.Code
import Cython.Compiler.FlowControl
import Cython.Compiler.Lexicon
import Cython.Compiler.Parsing
import Cython.Compiler.Scanning
import Cython.Compiler.Visitor
import Cython.Plex.Actions
import Cython.Plex.Scanners
#import Cython.Runtime.refnanny

import sys
import os
import subprocess
from pprint import pprint
from os.path import isfile

print('sys.executable: %r' % sys.executable)
print('sys.prefix: %r' % sys.prefix)
print('sys.version: %r' % sys.version)
print('PATH: %r' % os.environ['PATH'])
print('CWD: %r' % os.getcwd())

from distutils.sysconfig import get_config_var
from distutils.spawn import find_executable
from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext

if find_executable('gcc'):
    test_path = os.path.dirname(os.path.abspath(__file__))
    fib_path = os.path.join(test_path, "fib.pyx")
    output_file = os.path.join(test_path, "fib" + get_config_var('EXT_SUFFIX'))

    # SAT-4307: handle cases when directory is read-only
    if os.access(test_path, os.X_OK | os.W_OK):
        sys.argv[1:] = ['build_ext', '--inplace']
        setup(name='fib',
              cmdclass={'build_ext': build_ext},
              ext_modules=[Extension("fib", [fib_path])])

        try:
            import fib
            assert fib.fib(10) == 55
        except ImportError:
            cmd = [sys.executable, '-c', 'import fib; print(fib.fib(10))']
            out = subprocess.check_output(cmd)
            assert out.decode('utf-8').strip() == '55'
        finally:
            os.remove(output_file)
#  --- run_test.py (end) ---

print('===== cython-0.29.25-py38hbcddfd3_0 OK =====');
print("import: 'Cython'")
import Cython

print("import: 'Cython.Build'")
import Cython.Build

print("import: 'Cython.Compiler'")
import Cython.Compiler

print("import: 'Cython.Runtime'")
import Cython.Runtime

print("import: 'Cython.Distutils'")
import Cython.Distutils

print("import: 'Cython.Debugger'")
import Cython.Debugger

print("import: 'Cython.Debugger.Tests'")
import Cython.Debugger.Tests

print("import: 'Cython.Plex'")
import Cython.Plex

print("import: 'Cython.Tests'")
import Cython.Tests

print("import: 'Cython.Build.Tests'")
import Cython.Build.Tests

print("import: 'Cython.Compiler.Tests'")
import Cython.Compiler.Tests

print("import: 'Cython.Utility'")
import Cython.Utility

print("import: 'Cython.Tempita'")
import Cython.Tempita

print("import: 'pyximport'")
import pyximport

