import utils
import argparse
import os.path
from io import StringIO

basedir = os.path.dirname(os.path.abspath(__file__))

def test_basic():
    argv = [
      "ee",
      "--kicad-pcb",
      os.path.join(basedir, "../kicad_pcb/parser-1.kicad_pcb")
    ]
    buf = StringIO()
    try:
        with utils.make_env(argv=argv, stdout=buf): 
            import ee.tools.kicad_make_pos
    except SystemExit as e:
        raise e
    finally:
        print("Output")
        buf.seek(0)
        count = 0
        for l in buf.readlines():
            print(l.rstrip())
            count = count + 1
        assert count > 3