8000 apply black formatting · Develop-Python/procrastinate@c4a67c8 · GitHub
[go: up one dir, main page]

Skip to content

Commit c4a67c8

Browse files
committed
apply black formatting
1 parent 6a2eae8 commit c4a67c8

File tree

2 files changed

+9
-12
lines changed

2 files changed

+9
-12
lines changed

procrastinate/testing.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,8 @@ def defer_job_one(
9494
self, task_name, lock, queueing_lock, args, scheduled_at, queue
9595
) -> JobRow:
9696
if queueing_lock is not None and any(
97-
job['queueing_lock'] == queueing_lock and job['status'] == 'todo' for job in self.jobs.values()
97+
job["queueing_lock"] == queueing_lock and job["status"] == "todo"
98+
for job in self.jobs.values()
9899
):
99100
raise exceptions.UniqueViolation(
100101
constraint_name=connector.QUEUEING_LOCK_CONSTRAINT

tests/unit/test_testing.py

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,9 @@ def test_defer_job_one_multiple_times(connector):
104104
assert len(connector.jobs) == 2
105105

106106

107-
def test_defer_same_job_with_queueing_lock_second_time_after_first_one_succeeded(connector):
107+
def test_defer_same_job_with_queueing_lock_second_time_after_first_one_succeeded(
108+
connector,
109+
):
108110
job_data = {
109111
"task_name": "mytask",
110112
"lock": None,
@@ -115,27 +117,21 @@ def test_defer_same_job_with_queueing_lock_second_time_after_first_one_succeeded
115117
}
116118

117119
# 1. Defer job with queueing-lock
118-
job_row = connector.defer_job_one(
119-
**job_data
120-
)
120+
job_row = connector.defer_job_one(**job_data)
121121
assert len(connector.jobs) == 1
122122

123123
# 2. Defering a second time should fail, as first one
124124
# still in state `todo`
125125
with pytest.raises(exceptions.UniqueViolation):
126-
connector.defer_job_one(
127-
**job_data
128-
)
126+
connector.defer_job_one(**job_data)
129127
assert len(connector.jobs) == 1
130128

131129
# 3. Finish first job
132-
connector.finish_job_run(job_id=job_row['id'], status="finished", delete_job=False)
130+
connector.finish_job_run(job_id=job_row["id"], status="finished", delete_job=False)
133131

134132
# 4. Defering a second time should work now,
135133
# as first job in state `finished`
136-
connector.defer_job_one(
137-
**job_data
138-
)
134+
connector.defer_job_one(**job_data)
139135
assert len(connector.jobs) == 2
140136

141137

0 commit comments

Comments
 (0)
0