示例#1
0
def runner():
    r = Runner()

    yield r

    # cleanup
    r.cleanup()
示例#2
0
def runner():
    r = Runner()
    r.login()

    reponame = util.randrepo()
    r.runcommand("gin", "create", reponame, "Test a minimal workflow")
    r.reponame = reponame
    r.cdrel(reponame)
    r.repositories[r.cmdloc] = reponame

    yield r

    r.cleanup()
    r.logout()
示例#3
0
def runner():
    r = Runner(True)
    r.login()

    reponame = util.randrepo()
    r.runcommand("gin", "create", reponame,
                 "Test repository for all states")
    r.cdrel(reponame)
    r.repositories[r.cmdloc] = reponame

    yield r

    r.cleanup()
    r.logout()
def runner():
    r = Runner()
    r.login()

    reponame = util.randrepo()
    r.reponame = reponame

    localdir = f"{reponame}-local-clone"
    os.mkdir(localdir)
    r.cdrel(localdir)

    yield r

    r.cleanup()
    r.logout()
示例#5
0
def runner(request):
    offline = "offline" in request.node.keywords
    r = Runner(not offline)
    # create repo locally only
    reponame = util.randrepo()
    localdir = f"{reponame}"
    os.mkdir(localdir)
    r.cdrel(localdir)
    r.reponame = None if offline else reponame

    yield r

    # cleanup
    r.cleanup()
    r.logout()
示例#6
0
def runner():
    r = Runner()
    r.login()
    # create repo (remote and local) and cd into directory
    reponame = util.randrepo()
    print("Setting up test repository")
    r.runcommand("gin", "create", reponame,
                 "Test repository for cascading configurations")
    r.reponame = reponame
    r.cdrel(reponame)
    r.repositories[r.cmdloc] = reponame

    yield r

    r.cleanup()
    r.logout()
示例#7
0
def runner():
    remoteloc = tempfile.TemporaryDirectory(prefix="gintest-remote")
    r = Runner(False)
    reponame = util.randrepo()
    os.mkdir(reponame)
    r.cdrel(reponame)
    r.runcommand("gin", "init")
    r.runcommand("gin", "add-remote", "--create", "--default", "origin",
                 f"dir:{remoteloc.name}")
    r.runcommand("gin", "upload")

    r.repositories[r.cmdloc] = None

    yield r

    r.cleanup()
示例#8
0
def runner():
    remoteloc = tempfile.TemporaryDirectory(prefix="gintest-remote")
    r = Runner(False)
    # create repo (remote and local) and cd into directory
    reponame = util.randrepo()
    print("Setting up test repository")
    os.mkdir(reponame)
    r.cdrel(reponame)
    r.runcommand("gin", "init")
    r.runcommand("gin", "add-remote", "--create", "--default", "origin",
                 f"dir:{remoteloc.name}")
    r.reponame = reponame
    r.repositories[r.cmdloc] = None

    r.hashes = dict()
    head, curhashes = util.hashtree(r)
    r.hashes[head] = curhashes

    # add files and compute their md5 hashes
    print("Creating files")
    create_files(r)
    out, err = r.runcommand("gin", "commit", ".")
    head, curhashes = util.hashtree(r)
    r.hashes[head] = curhashes
    r.commitcount = 2

    n = 10
    print(f"Modifying files {n} times")
    for _ in range(n):
        create_files(r)
        out, err = r.runcommand("gin", "commit", ".")
        head, curhashes = util.hashtree(r)
        r.hashes[head] = curhashes
        r.commitcount += 1

    # TODO: Add some symlinks to the directories (not Windows)

    # verify commit count before returning
    assert util.getrevcount(r) == r.commitcount

    yield r

    r.cleanup()
    r.logout()

    print("DONE!")
示例#9
0
def runner():
    r = Runner()
    r.login()
    # username = r.username
    # create repo (remote and local) and cd into directory
    reponame = util.randrepo()
    # repopath = f"{username}/{reponame}"
    r.runcommand("gin", "create", reponame,
                 "Test repository for error output. Created with test scripts")
    r.reponame = reponame
    r.repositories[r.cmdloc] = reponame

    r.cdrel(reponame)
    r.runcommand("gin", "upload")
    r.cdrel("..")

    yield r

    r.cleanup()
    r.logout()
def runner():
    r = Runner()
    # change config dir to some temporary directory with spaces in the name
    defaultconfdir = r.env["GIN_CONFIG_DIR"]
    conftemp = tempfile.TemporaryDirectory(prefix="conf place with spaces")
    spaceconfdir = os.path.join(conftemp.name, "conf")
    r.env["GIN_CONFIG_DIR"] = spaceconfdir
    shutil.copytree(defaultconfdir, spaceconfdir)
    r.login()
    # create repo (remote and local) and cd into directory
    reponame = util.randrepo()
    print("Setting up test repository")
    r.runcommand("gin", "create", reponame,
                 "Test repository for alt config path (with spaces)")
    r.cdrel(reponame)
    r.repositories[r.cmdloc] = reponame

    yield r

    r.cleanup()
    r.logout()
def runner():
    r = Runner(True)
    r.login()

    # manually set up repository with annex v5

    reponame = util.randrepo()
    r.runcommand("gin", "create", "--no-clone", reponame,
                 "Test repository for annex upgrade")
    os.mkdir(reponame)
    r.cdrel(reponame)
    r.runcommand("git", "init")
    r.runcommand("git", "annex", "init", "--version=5")
    r.runcommand("gin", "add-remote", "origin",
                 f"test:{r.username}/{reponame}")
    r.repositories[r.cmdloc] = reponame

    yield r

    r.cleanup()
    r.logout()
示例#12
0
def drunner():
    remoteloc = tempfile.TemporaryDirectory(prefix="gin-cli-test")
    r = Runner(False)

    reponame = util.randrepo()
    r.reponame = reponame
    os.mkdir(reponame)
    r.cdrel(reponame)

    # Create repo in A
    r.runcommand("gin", "init")
    r.runcommand("gin", "add-remote", "--create", "--default", "origin",
                 f"dir:{remoteloc.name}")
    r.runcommand("gin", "upload")
    r.repositories[r.cmdloc] = None
    r.remotedir = remoteloc

    yield r

    util.set_rwx_recursive(remoteloc.name)
    r.cleanup()
示例#13
0
    ap.add_argument("-f",
                    "--framerate",
                    type=int,
                    default=32,
                    help="# of frames used to construct the background model")
    args = vars(ap.parse_args())

    # initialize the video stream and allow the camera sensor
    vs = VideoStream(usePiCamera=True,
                     resolution=(args["width"], args["height"]),
                     framerate=args["framerate"]).start()

    # camera warmup
    time.sleep(2.0)

    # start a thread that will perform motion detection
    t = threading.Thread(target=process_video, args=(args["framerate"], ))
    t.daemon = True
    t.start()
    wc.run()
    # start the flask app
    app.run(host=args["ip"],
            port=args["port"],
            debug=True,
            threaded=True,
            use_reloader=False)

# release the video stream pointer
vs.stop()
runner.cleanup()