# Oban testing with elixir and python

**URL:** <https://forum.elixirforum.com/t/oban-testing-with-elixir-and-python/75023>\
**Category:** Questions\
**Tags:** python, oban\
**Created:** [April 15, 2026, 6:16pm UTC](https://forum.elixirforum.com/t/oban-testing-with-elixir-and-python/75023 "2026-04-15T18:16:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![tjchambers](https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/tjchambers/32/17299_2.png) [@tjchambers](https://forum.elixirforum.com/u/tjchambers)\
**Post date:** [April 15, 2026, 6:16pm UTC](https://forum.elixirforum.com/t/oban-testing-with-elixir-and-python/75023/1 "2026-04-15T18:16:07Z")

</div>

I am trying to bridge Elixir and Python, and am getting a failure in testing.

```elixir
   ** (RuntimeError) unknown worker: agr. __main__.AgrWorker
     code: Oban.Testing.with_testing_mode(:inline, fn ->
     stacktrace:
       (oban 2.21.1) lib/oban/queue/executor.ex:109: Oban.Queue.Executor.resolve_worker/1
       (oban 2.21.1) lib/oban/queue/executor.ex:74: Oban.Queue.Executor.call/1
       (oban 2.21.1) lib/oban/engines/inline.ex:104: Oban.Engines.Inline.execute_job/2
       (oban 2.21.1) lib/oban/engines/inline.ex:37: Oban.Engines.Inline.insert_job/3
       (oban 2.21.1) lib/oban/engine.ex:216: anonymous fn/4 in Oban.Engine.insert_job/3
       (oban 2.21.1) lib/oban/engine.ex:404: anonymous fn/3 in Oban.Engine.with_span/4

```

As far as I can tell using code I have deduced my Python worker is “\__main_\_.AgrWorker" however no matter what I put in as a worker name, I get an error in finding the worker on the elixir side when I run my tests. I am running my test inline for a worker (an Elixir module). This elixir module enqueues a job which is for a Python class “AgrWorker”. It “seems” like what is happening is that because the test is “inline” on th Elixir side, the subsequent enqueue `expects` any subsequent Oban Job to also be in Elixir - i.e. it is looking for the Elixir worker to run.

I am not sure how or why it would be able to know about all of the Python Workers available.

Can anyone help me with why this makes any sense?

---

<div class="post-metadata">

**Author:** ![kokolegorille](https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/kokolegorille/32/4784_2.png) [@kokolegorille](https://forum.elixirforum.com/u/kokolegorille)\
**Post date:** [April 15, 2026, 6:18pm UTC](https://forum.elixirforum.com/t/oban-testing-with-elixir-and-python/75023/2 "2026-04-15T18:18:47Z")

</div>

If You don’t mind I have switched the OP section from Question to Oban.

---

<div class="post-metadata">

**Author:** ![sorentwo](https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/sorentwo/32/37360_2.png) [@sorentwo](https://forum.elixirforum.com/u/sorentwo)\
**Post date:** [April 16, 2026, 6:54am UTC](https://forum.elixirforum.com/t/oban-testing-with-elixir-and-python/75023/3 "2026-04-16T06:54:23Z")

</div>

> [@tjchambers](#):
>
> I am running my test inline for a worker (an Elixir module). This elixir module enqueues a job which is for a Python class “AgrWorker”. It “seems” like what is happening is that because the test is “inline” on th Elixir side, the subsequent enqueue `expects` any subsequent Oban Job to also be in Elixir - i.e. it is looking for the Elixir worker to run.

That’s correct. The inline engine runs jobs immediately, as they are inserted, and it never touches the database. In that case the job is referencing a Python class that’s not available as an Elixir module, and there’s no worker module to load and run.

> [@tjchambers](#):
>
> I am not sure how or why it would be able to know about all of the Python Workers available.

It wouldn’t. In fact, Oban in Elixir isn’t aware that Oban in Python exists at all. They speak the same “language” via the database schema and pubsub ([Bridging Elixir and Python with Oban · Oban Pro](https://oban.pro/articles/bridging-with-oban)), but they can’t interchangeably execute code.

You’ll need to use `manual` mode to test enqueuing Python jobs, and ensure they’re inserted into a queue that isn’t ran by your Elixir app. Something like this:

```elixir
# config/test.exs
config :my_app, Oban,
  queues: [
    default: 10, # runs in elixir
  ],
  testing: :manual,
  ...

# some_test.exs

args
|> Oban.Job.new(queue: :bridge, worker: "_main_.AgrWorker")
|> Oban.insert!()

# Assert that it's enqueued, don't run it
assert_enqueued queue: :bridge, worker: "_main_.AgrWorker"

```

The jobs won’t execute during tests, but you can be sure they’re in the bridge queue.

Note that Ecto tests run in a sandbox, essentially a transaction, and whatever is inserted during a test is invisible to all other processes or connections. The only way to test end-to-end is without the sandbox enabled an with manual cleanup steps, which may be worth it eventually, but it’s not where I’d start.
