Skip to content

Commit

Permalink
Fix to restore linting of tests directory.
Browse files Browse the repository at this point in the history
Fix up regressions missed while linting was off and add import order linting for the whole module.
  • Loading branch information
jmchilton committed Sep 1, 2016
1 parent a152f3c commit a8e797b
Show file tree
Hide file tree
Showing 28 changed files with 93 additions and 80 deletions.
4 changes: 2 additions & 2 deletions tests/shed_app.py
@@ -1,11 +1,11 @@
""" Test app to emulate planemo-relevant portions of the
the ToolShed API... for now :).
"""
import os
import json
import os
import tarfile
from uuid import uuid4

from uuid import uuid4
from xml.etree import ElementTree

from flask import (
Expand Down
10 changes: 6 additions & 4 deletions tests/shed_app_test_utils.py
@@ -1,17 +1,19 @@
from collections import namedtuple
import contextlib
import shutil
from tempfile import mkdtemp
import threading
from requests import post

from collections import namedtuple
from tempfile import mkdtemp

from requests import post
from werkzeug.serving import run_simple

from planemo import network_util

from .shed_app import (
app,
InMemoryShedDataModel,
)
from planemo import network_util

DEFAULT_OP_TIMEOUT = 2

Expand Down
9 changes: 4 additions & 5 deletions tests/test_cmd_serve.py
@@ -1,20 +1,20 @@
import functools
import os
import time
import threading
import time
import uuid

from planemo.galaxy import api
from planemo import network_util
from planemo.galaxy import api
from planemo.io import kill_pid_file

from .test_utils import (
CliTestCase,
PROJECT_TEMPLATES_DIR,
skip_if_environ,
skip_unless_environ,
TEST_REPOS_DIR,
PROJECT_TEMPLATES_DIR,
TEST_DATA_DIR,
TEST_REPOS_DIR,
)

TEST_HISTORY_NAME = "Cool History 42"
Expand Down Expand Up @@ -106,7 +106,6 @@ def _launch_thread_and_wait(self, func, args=[]):
assert network_util.wait_net_service("127.0.0.1", port)

def _run(self, serve_args=[]):
cat_path = os.path.join(TEST_REPOS_DIR, "single_tool", "cat.xml")
test_cmd = [
"serve",
"--install_galaxy",
Expand Down
5 changes: 3 additions & 2 deletions tests/test_cmd_shed_serve.py
@@ -1,14 +1,15 @@
import functools
import os
import time
import threading
import time

from planemo import network_util

from .test_utils import (
CliTestCase,
skip_if_environ,
TEST_REPOS_DIR,
)
from planemo import network_util


class ShedServeTestCase(CliTestCase):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_cmd_test.py
Expand Up @@ -6,9 +6,9 @@
assert_exists,
CliTestCase,
PROJECT_TEMPLATES_DIR,
skip_unless_python_2_7,
skip_if_environ,
skip_unless_environ,
skip_unless_python_2_7,
TEST_DATA_DIR,
)

Expand Down
3 changes: 2 additions & 1 deletion tests/test_command_io.py
@@ -1,7 +1,8 @@
"""Test cases for the CommandIO abstraction in tool_builder."""

from planemo.tool_builder import CommandIO
from test_utils import assert_equal

from .test_utils import assert_equal


def test_simplest_command():
Expand Down
4 changes: 2 additions & 2 deletions tests/test_dependency_script.py
@@ -1,11 +1,11 @@
import os
import glob
import os
import tempfile

from .test_utils import (
CliTestCase,
TEST_REPOS_DIR,
skip_if_environ,
TEST_REPOS_DIR,
)


Expand Down
4 changes: 2 additions & 2 deletions tests/test_engines.py
@@ -1,12 +1,12 @@
"""Unit tests for engines and runnables."""

import os

from planemo.engine import engine_context
from planemo.runnable import for_path
from planemo.runnable import get_outputs


from .test_utils import CWL_DRAFT3_DIR, TEST_DATA_DIR, test_context
from .test_utils import CWL_DRAFT3_DIR, test_context, TEST_DATA_DIR

A_CWL_TOOL = os.path.join(CWL_DRAFT3_DIR, "cat3-tool.cwl")
A_CWL_WORKFLOW = os.path.join(CWL_DRAFT3_DIR, "count-lines1-wf.cwl")
Expand Down
4 changes: 2 additions & 2 deletions tests/test_galaxy_config.py
Expand Up @@ -2,10 +2,10 @@
import contextlib
import os

from .test_utils import TempDirectoryContext, test_context

from planemo.galaxy.config import galaxy_config

from .test_utils import TempDirectoryContext, test_context


def test_defaults():
"""Test by default Galaxy files are stored in temp ``config_directory``."""
Expand Down
13 changes: 7 additions & 6 deletions tests/test_galaxy_serve.py
Expand Up @@ -5,17 +5,18 @@
"""
import os

from planemo import network_util
from planemo import shed
from planemo.galaxy import galaxy_serve, shed_serve
from planemo.runnable import for_path

from .test_utils import (
CliTestCase,
PROJECT_TEMPLATES_DIR,
skip_if_environ,
TEST_REPOS_DIR,
TEST_DATA_DIR,
PROJECT_TEMPLATES_DIR,
TEST_REPOS_DIR,
)
from planemo.runnable import for_path
from planemo.galaxy import galaxy_serve, shed_serve
from planemo import network_util
from planemo import shed


class GalaxyServeTestCase(CliTestCase):
Expand Down
11 changes: 5 additions & 6 deletions tests/test_galaxy_test.py
Expand Up @@ -3,16 +3,15 @@
import os
import shutil

from .test_utils import (
test_context,
TempDirectoryTestCase,
TEST_DATA_DIR,
)

from planemo.galaxy.test import structures
from planemo.galaxy.test.actions import passed
from planemo.galaxy.test.actions import run_in_config

from .test_utils import (
TempDirectoryTestCase,
test_context,
TEST_DATA_DIR,
)

nose_1_3_report = os.path.join(TEST_DATA_DIR, "xunit_nose_1_3.xml")
nose_0_11_report = os.path.join(TEST_DATA_DIR, "xunit_nose_0_11.xml")
Expand Down
3 changes: 2 additions & 1 deletion tests/test_galaxy_workflow_utils.py
@@ -1,9 +1,10 @@
"""Test utilities for dealing with Galaxy workflows."""
import os

from .test_utils import TEST_DATA_DIR
from planemo.galaxy.workflows import describe_outputs

from .test_utils import TEST_DATA_DIR


def test_describe_outputs():
wf_path = os.path.join(TEST_DATA_DIR, "wf1.gxwf.yml")
Expand Down
3 changes: 2 additions & 1 deletion tests/test_git.py
@@ -1,9 +1,10 @@
import contextlib
import os

from .test_utils import io
from planemo import git

from .test_utils import io

EXPECTED_HELLO_REV = "1c36390f585f8baa953548c00fc18c58e32fcf8b"

COMMITTER_DATE = "GIT_COMMITTER_DATE='2000-01-01T00:00:00+0000'"
Expand Down
2 changes: 1 addition & 1 deletion tests/test_io.py
@@ -1,7 +1,7 @@
"""Test utilities from :module:`planemo.io`."""
from .test_utils import (
io,
assert_equal,
io,
)


Expand Down
4 changes: 2 additions & 2 deletions tests/test_lint.py
@@ -1,10 +1,10 @@
import os
import glob
import os

from .test_utils import (
CliTestCase,
TEST_TOOLS_DIR,
TEST_REPOS_DIR,
TEST_TOOLS_DIR,
)


Expand Down
1 change: 0 additions & 1 deletion tests/test_profile_commands.py
@@ -1,6 +1,5 @@
from .test_utils import (
CliTestCase,
skip_unless_environ,
)


Expand Down
9 changes: 5 additions & 4 deletions tests/test_shed.py
Expand Up @@ -2,21 +2,22 @@
"""

import os
import string
import random
import string

import yaml

from bioblend import toolshed

from planemo import io
from planemo.shed import username

from .test_utils import (
skip_unless_environ,
CliTestCase,
skip_unless_environ,
TEST_DIR
)

from planemo.shed import username
from planemo import io

SHED_TEMPLATE = string.Template("""owner: ${owner}
name: ${name}
Expand Down
3 changes: 2 additions & 1 deletion tests/test_shed_create.py
@@ -1,6 +1,7 @@
from planemo import shed

from .test_utils import CliShedTestCase
from .test_utils import skip
from planemo import shed

CS1_DESCRIPTION = "The tool Cat 1 from the cat tool suite."
CS2_DESCRIPTION = "The tool Cat 2 from the cat tool suite."
Expand Down
18 changes: 10 additions & 8 deletions tests/test_shed_diff.py
@@ -1,19 +1,21 @@
""" Integration tests for shed_diff command.
"""

from os.path import join
from .test_utils import (
CliShedTestCase,
TEST_REPOS_DIR,
)
from planemo import io
import tempfile
import sys
import os
import sys
import tempfile

from os.path import join
from xml.etree import ElementTree

from planemo import io
from planemo.xml.diff import diff

from .test_shed_upload import update_package_1
from .test_utils import (
CliShedTestCase,
TEST_REPOS_DIR,
)

DIFF_LINES = [
"diff -r _workingdir_/related_file _custom_shed_/related_file",
Expand Down
3 changes: 2 additions & 1 deletion tests/test_shed_diff_xml.py
@@ -1,8 +1,9 @@
import os

from .test_utils import TEST_DIR
from planemo.shed import diff

from .test_utils import TEST_DIR


def test_compare():
local = os.path.join(TEST_DIR, "repository_dependencies.xml")
Expand Down
4 changes: 2 additions & 2 deletions tests/test_shed_expansion.py
Expand Up @@ -3,10 +3,10 @@

import yaml

from .test_utils import TempDirectoryTestCase

from planemo import shed

from .test_utils import TempDirectoryTestCase


class ShedExpansionTestCase(TempDirectoryTestCase):

Expand Down
10 changes: 5 additions & 5 deletions tests/test_shed_operations.py
@@ -1,14 +1,14 @@
""" Test some lower-level utilities in planemo.shed.
"""
"""Test some lower-level utilities in planemo.shed."""

import os

from planemo import shed

from .test_utils import (
TEST_REPOS_DIR,
mock_shed_context,
TEST_REPOS_DIR,
)

from planemo import shed


def test_find_repository_id():
with mock_shed_context() as shed_context:
Expand Down
12 changes: 7 additions & 5 deletions tests/test_shed_upload.py
Expand Up @@ -3,18 +3,20 @@
Specifically, tests for shed_upload, shed_download, and shed_create.
commands.
"""
from os.path import exists, join
import os
import tarfile
import shutil
import tarfile

from os.path import exists, join

from planemo import git
from planemo.io import shell

from .test_utils import (
assert_exists,
CliShedTestCase,
TEST_REPOS_DIR,
assert_exists,
)
from planemo.io import shell
from planemo import git


class ShedUploadTestCase(CliShedTestCase):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_test_checker.py
Expand Up @@ -2,8 +2,8 @@
import os

from planemo.runnable import (
for_path,
cases,
for_path,
)

from .test_utils import TEST_DATA_DIR
Expand Down

0 comments on commit a8e797b

Please sign in to comment.