Skip to content

Commit

Permalink
fixed pep8
Browse files Browse the repository at this point in the history
  • Loading branch information
wouterdb committed Nov 7, 2018
1 parent 5214ff2 commit f4756e0
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 12 deletions.
1 change: 0 additions & 1 deletion src/inmanta/agent/handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@

from inmanta.agent.io import get_io
from inmanta import protocol, resources, const, data
from tornado import ioloop
from inmanta.module import Project
from inmanta.agent.cache import AgentCache
import uuid
Expand Down
11 changes: 6 additions & 5 deletions src/inmanta/server/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import logging
import os
import re
import subprocess
import sys
import tempfile
import time
Expand Down Expand Up @@ -1530,12 +1529,14 @@ def _recompile_environment(self, environment_id, update_repo=False, wait=0, meta

# verify if branch is correct
LOGGER.debug("Verifying correct branch")
sub_process = process.Subprocess(["git", "branch"], stdout=process.Subprocess.STREAM, stderr=process.Subprocess.STREAM,
sub_process = process.Subprocess(["git", "branch"],
stdout=process.Subprocess.STREAM,
stderr=process.Subprocess.STREAM,
cwd=project_dir)

out, log_err, returncode = yield [gen.Task(sub_process.stdout.read_until_close),
gen.Task(sub_process.stderr.read_until_close),
sub_process.wait_for_exit(raise_error=False)]
out, _, _ = yield [gen.Task(sub_process.stdout.read_until_close),
gen.Task(sub_process.stderr.read_until_close),
sub_process.wait_for_exit(raise_error=False)]

o = re.search("\* ([^\s]+)$", out.decode(), re.MULTILINE)
if o is not None and env.repo_branch != o.group(1):
Expand Down
5 changes: 2 additions & 3 deletions tests/test_protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import random
import base64
import threading
import time

import pytest
from tornado.httpclient import HTTPRequest, AsyncHTTPClient
Expand Down Expand Up @@ -71,7 +70,7 @@ def test_client_files(client):
def test_sync_client_files(client):
done = []
limit = 100
sleep= 0.01
sleep = 0.01

def do_test():
sync_client = protocol.SyncClient("client")
Expand All @@ -98,7 +97,7 @@ def do_test():
thread.start()

while len(done) == 0 and limit > 0:
yield gen.sleep(0.01)
yield gen.sleep(sleep)
limit -= 1

thread.join()
Expand Down
12 changes: 9 additions & 3 deletions tests/test_server_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -2801,17 +2801,19 @@ def test_server_recompile(server_multi, client_multi, environment_multi):
def wait_for_version(cnt):
# Wait until the server is no longer compiling
# wait for it to finish
yield gen.sleep(0.1)
code = 200
while code == 200:
compiling = yield client.is_compiling(environment)
code = compiling.code
yield gen.sleep(1)

yield gen.sleep(0.1)
# wait for it to appear
versions = yield client.list_versions(environment)

while versions.result["count"] < cnt:
logger.info(versions.result)
versions = yield client.list_versions(environment)
yield gen.sleep(0.1)

return versions.result

Expand All @@ -2832,9 +2834,10 @@ def wait_for_version(cnt):
std::ConfigFile(host=host, path="/etc/motd", content="1234")
""")

# request a compile
logger.info("request a compile")
yield client.notify_change(environment)

logger.info("wait for 1")
versions = yield wait_for_version(1)
assert versions["versions"][0]["total"] == 1
assert versions["versions"][0]["version_info"]["export_metadata"]["type"] == "api"
Expand All @@ -2848,8 +2851,10 @@ def wait_for_version(cnt):
versions = yield wait_for_version(1)
assert versions["count"] == 1

logger.info("request second compile")
# set a new parameter and request a recompile
yield client.set_param(environment, id="param2", value="test", source="plugin", recompile=True)
logger.info("wait for 2")
versions = yield wait_for_version(2)
assert versions["versions"][0]["version_info"]["export_metadata"]["type"] == "param"
assert versions["count"] == 2
Expand All @@ -2862,6 +2867,7 @@ def wait_for_version(cnt):
# update the parameter to a new value
yield client.set_param(environment, id="param2", value="test2", source="plugin", recompile=True)
versions = yield wait_for_version(3)
logger.info("wait for 3")
assert versions["count"] == 3


Expand Down

0 comments on commit f4756e0

Please sign in to comment.