Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(168)  |  Call(148)  |  Derive(0)  |  Import(20)

src/t/r/tron-0.6.1.1/tests/core/job_test.py   tron(Download)
from testify.assertions import assert_not_equal
from tests import mocks
from tests.assertions import assert_length, assert_call, assert_mock_calls
from tests.testingutils import Turtle, autospec_method
from tests import testingutils
        assert_call(self.job.runs.build_new_run,
                0, self.job, run_time, node, manual=False)
        assert_length(runs, 1)
        self.job.watch.assert_called_with(runs[0])
 
        runs = list(self.job.build_new_runs(run_time))
 
        assert_length(runs, node_count)
        for i in xrange(len(runs)):
            node = self.job.node_pool.nodes[i]
        self.job.node_pool.next.assert_called_with()
        node = self.job.node_pool.next.return_value
        assert_length(runs, 1)
        assert_call(self.job.runs.build_new_run,
                0, self.job, run_time, node, manual=True)
        self.job_scheduler.restore_state(state_data)
        assert_call(self.job_scheduler.job.restore_state, 0, state_data)
        assert_length(self.job_scheduler._set_callback.calls, 1)
        assert_call(self.job_scheduler._set_callback, 0, 'a')
 

src/t/r/Tron-HEAD/tests/core/job_test.py   Tron(Download)
from testify.assertions import assert_not_equal
from tests import mocks
from tests.assertions import assert_length, assert_call, assert_mock_calls
from tests.testingutils import Turtle, autospec_method
from tests import testingutils
        assert_call(self.job.runs.build_new_run,
                0, self.job, run_time, node, manual=False)
        assert_length(runs, 1)
        self.job.watch.assert_called_with(runs[0])
 
        runs = list(self.job.build_new_runs(run_time))
 
        assert_length(runs, node_count)
        for i in xrange(len(runs)):
            node = self.job.node_pool.nodes[i]
        self.job.node_pool.next.assert_called_with()
        node = self.job.node_pool.next.return_value
        assert_length(runs, 1)
        assert_call(self.job.runs.build_new_run,
                0, self.job, run_time, node, manual=True)
        self.job_scheduler.restore_state(state_data)
        assert_call(self.job_scheduler.job.restore_state, 0, state_data)
        assert_length(self.job_scheduler._set_callback.calls, 1)
        assert_call(self.job_scheduler._set_callback, 0, 'a')
 

src/t/r/tron-0.6.1.1/tests/core/jobrun_test.py   tron(Download)
from testify import TestCase, setup, assert_equal
from testify.assertions import assert_in
from tests.assertions import assert_length, assert_raises, assert_call
from tron import node, event, actioncommand
from tron.core import jobrun, actionrun, actiongraph, job
    def test_from_state(self):
        run = jobrun.JobRun.from_state(self.state_data, self.action_graph,
            self.output_path, self.context, self.node_pool)
        assert_length(run.action_runs.run_map, 1)
        assert_equal(run.job_name, self.state_data['job_name'])
    def test_from_state_node_no_longer_exists(self):
        run = jobrun.JobRun.from_state(self.state_data, self.action_graph,
            self.output_path, self.context, self.node_pool)
        assert_length(run.action_runs.run_map, 1)
        assert_equal(run.job_name, 'thejobname')
        assert_equal(run_collection.runs[0].run_num, 3)
        assert_equal(run_collection.runs[3].run_num, 0)
        assert_length(restored_runs, 4)
 
    def test_restore_state_with_runs(self):
    def test_remove_pending(self):
        self.run_collection.remove_pending()
        assert_length(self.run_collection.runs, 3)
        assert_equal(self.run_collection.runs[0], self.job_runs[1])
        assert_call(self.job_runs[0].cleanup, 0)

src/t/r/Tron-HEAD/tests/core/jobrun_test.py   Tron(Download)
from testify import TestCase, setup, assert_equal
from testify.assertions import assert_in
from tests.assertions import assert_length, assert_raises, assert_call
from tron import node, event, actioncommand
from tron.core import jobrun, actionrun, actiongraph, job
    def test_from_state(self):
        run = jobrun.JobRun.from_state(self.state_data, self.action_graph,
            self.output_path, self.context, self.node_pool)
        assert_length(run.action_runs.run_map, 1)
        assert_equal(run.job_name, self.state_data['job_name'])
    def test_from_state_node_no_longer_exists(self):
        run = jobrun.JobRun.from_state(self.state_data, self.action_graph,
            self.output_path, self.context, self.node_pool)
        assert_length(run.action_runs.run_map, 1)
        assert_equal(run.job_name, 'thejobname')
        assert_equal(run_collection.runs[0].run_num, 3)
        assert_equal(run_collection.runs[3].run_num, 0)
        assert_length(restored_runs, 4)
 
    def test_restore_state_with_runs(self):
    def test_remove_pending(self):
        self.run_collection.remove_pending()
        assert_length(self.run_collection.runs, 3)
        assert_equal(self.run_collection.runs[0], self.job_runs[1])
        assert_call(self.job_runs[0].cleanup, 0)

src/t/r/tron-0.6.1.1/tests/utils/observer_test.py   tron(Download)
from testify import run, setup, assert_equal, TestCase, turtle
from tests.assertions import assert_length
from tron.utils.observer import Observable, Observer
 
 
    def test_remove_observer_none(self):
        observer = lambda: 2
        self.obs.remove_observer(observer)
        assert_equal(set(self.obs._observers.keys()), set([True, 'a', 'b']))
        assert_length(self.obs._observers['a'], 2)
        assert_length(self.obs._observers['b'], 2)
        assert_length(self.obs._observers[True], 1)
        self.obs.attach('c', observer)
        self.obs.remove_observer(observer)
        assert_length(self.obs._observers['a'], 2)
        assert_length(self.obs._observers['b'], 2)
        assert_length(self.obs._observers[True], 1)

src/t/r/Tron-HEAD/tests/utils/observer_test.py   Tron(Download)
from testify import run, setup, assert_equal, TestCase, turtle
from tests.assertions import assert_length
from tron.utils.observer import Observable, Observer
 
 
    def test_remove_observer_none(self):
        observer = lambda: 2
        self.obs.remove_observer(observer)
        assert_equal(set(self.obs._observers.keys()), set([True, 'a', 'b']))
        assert_length(self.obs._observers['a'], 2)
        assert_length(self.obs._observers['b'], 2)
        assert_length(self.obs._observers[True], 1)
        self.obs.attach('c', observer)
        self.obs.remove_observer(observer)
        assert_length(self.obs._observers['a'], 2)
        assert_length(self.obs._observers['b'], 2)
        assert_length(self.obs._observers[True], 1)

src/t/r/tron-0.6.1.1/tests/crash_reporter_test.py   tron(Download)
import logging
from testify import TestCase, run, setup, assert_equal
from testify.utils import turtle
from tests.assertions import assert_length, assert_call
 
    def test_emit_no_text(self):
        self.reporter.emit(self.event_dict)
        assert_length(self.emailer.send.calls, 0)
 
    def test_emit_unhandled(self):
        self.event_dict['message'] = ["Unhandled error in Deferred:"]
        self.event_dict['isError'] = True
        self.reporter.emit(self.event_dict)
        assert_length(self.emailer.send.calls, 0)
    def test_emit_ignored_level(self):
        self.event_dict['message'] = "Some message."
        self.reporter.emit(self.event_dict)
        assert_length(self.emailer.send.calls, 0)
 

src/t/r/Tron-HEAD/tests/crash_reporter_test.py   Tron(Download)
import logging
from testify import TestCase, run, setup, assert_equal
from testify.utils import turtle
from tests.assertions import assert_length, assert_call
 
    def test_emit_no_text(self):
        self.reporter.emit(self.event_dict)
        assert_length(self.emailer.send.calls, 0)
 
    def test_emit_unhandled(self):
        self.event_dict['message'] = ["Unhandled error in Deferred:"]
        self.event_dict['isError'] = True
        self.reporter.emit(self.event_dict)
        assert_length(self.emailer.send.calls, 0)
    def test_emit_ignored_level(self):
        self.event_dict['message'] = "Some message."
        self.reporter.emit(self.event_dict)
        assert_length(self.emailer.send.calls, 0)
 

src/t/r/tron-0.6.1.1/tests/core/serviceinstance_test.py   tron(Download)
import mock
from testify import setup, assert_equal, TestCase, run, setup_teardown
from testify.assertions import assert_in, assert_not_equal
from tests.assertions import assert_length
from tests.testingutils import autospec_method
    def test_create_missing(self):
        self.collection.config.count = 5
        autospec_method(self.collection._build_instance)
        created = self.collection.create_missing()
        assert_length(created, 5)
    def test_create_missing_none(self):
        self.collection.config.count = 2
        self.collection.instances = [create_mock_instance(instance_number=i) for i in range(2)]
        created = self.collection.create_missing()
        assert_length(created, 0)
        autospec_method(self.collection._build_instance)
        created = self.collection.restore_state(state_data)
        assert_length(created, count)
        assert_equal(set(created), set(self.collection.instances))
        expected = [
        self.collection.sort.assert_called_with()
        assert_equal(builder.mock_calls, [mock.call(i) for i in seq])
        assert_length(instances, count)
        assert_equal(instances, self.collection.instances)
 

src/t/r/Tron-HEAD/tests/core/serviceinstance_test.py   Tron(Download)
import mock
from testify import setup, assert_equal, TestCase, run, setup_teardown
from testify.assertions import assert_in, assert_not_equal
from tests.assertions import assert_length
from tests.testingutils import autospec_method
    def test_create_missing(self):
        self.collection.config.count = 5
        autospec_method(self.collection._build_instance)
        created = self.collection.create_missing()
        assert_length(created, 5)
    def test_create_missing_none(self):
        self.collection.config.count = 2
        self.collection.instances = [create_mock_instance(instance_number=i) for i in range(2)]
        created = self.collection.create_missing()
        assert_length(created, 0)
        autospec_method(self.collection._build_instance)
        created = self.collection.restore_state(state_data)
        assert_length(created, count)
        assert_equal(set(created), set(self.collection.instances))
        expected = [
        self.collection.sort.assert_called_with()
        assert_equal(builder.mock_calls, [mock.call(i) for i in seq])
        assert_length(instances, count)
        assert_equal(instances, self.collection.instances)
 

  1 | 2  Next