# Nameko test: Module already imported warning

**URL:** <https://discourse.nameko.io/t/nameko-test-module-already-imported-warning/714>\
**Category:** Uncategorized\
**Created:** [November 3, 2021, 6:16pm UTC](https://discourse.nameko.io/t/nameko-test-module-already-imported-warning/714 "2021-11-03T18:16:11Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![checor](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.nameko.io/checor/32/156_2.png) [@checor](https://discourse.nameko.io/u/checor)\
**Post date:** [November 3, 2021, 6:16pm UTC](https://discourse.nameko.io/t/nameko-test-module-already-imported-warning/714/1 "2021-11-03T18:16:11Z")

</div>

Hello, I’m using nameko and it’s a breeze!

I have a doubt about a warning I get when I run `nameko test`, as the pytest warning recommends.  
Every time I run it, it says:

```auto
========================================================================================= test session starts =========================================================================================
platform linux -- Python 3.8.10, pytest-6.2.5, py-1.10.0, pluggy-1.0.0
rootdir: /home/checor/nameko
plugins: nameko-sqlalchemy-1.5.0, nameko-2.14.0, cov-3.0.0
collected 1 item                                                                                                                                                                                      

test_service.py .    

========================================================================================== warnings summary ===========================================================================================
../../../.virtualenvs/nameko/lib/python3.8/site-packages/_pytest/config/ __init__.py:1114
  /home/checor/.virtualenvs/nameko/lib/python3.8/site-packages/_pytest/config/ __init__.py:1114: PytestAssertRewriteWarning: Module already imported so cannot be rewritten: nameko
    self._mark_plugins_for_rewrite(hook)

-- Docs: https://docs.pytest.org/en/stable/warnings.html

```

The `Module already imported so cannot be rewritten: nameko` worries me a little. Is it expected behaviour? My tests are running fine, but I want is there something that I missed before using `nameko test`.

Thanks!

---

<div class="post-metadata">

**Author:** ![mattbennett](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.nameko.io/mattbennett/32/13_2.png) [@mattbennett](https://discourse.nameko.io/u/mattbennett)\
**Post date:** [November 3, 2021, 8:49pm UTC](https://discourse.nameko.io/t/nameko-test-module-already-imported-warning/714/2 "2021-11-03T20:49:48Z")

</div>

Hey @checor,

Glad you’re enjoying Nameko.

This message is printed by pytest to warn users about the pitfalls of invoking pytest multiple times within the same process. See [the note at the bottom of this page](https://docs.pytest.org/en/latest/how-to/usage.html#calling-pytest-from-python-code).

We are invoking pytest using the Nameko CLI, and so when the `nameko` module is subsequently reimported by the tests it triggers this warning. We’re not actually running multiple pytest executions in the same process so the warning doesn’t mean anything.

In a future release it’d be a good to suppress it somehow, if that’s possible.

---

<div class="post-metadata">

**Author:** ![checor](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.nameko.io/checor/32/156_2.png) [@checor](https://discourse.nameko.io/u/checor)\
**Post date:** [November 4, 2021, 7:25am UTC](https://discourse.nameko.io/t/nameko-test-module-already-imported-warning/714/3 "2021-11-04T07:25:23Z")

</div>

That explains it all!  
Thanks for the fast response. Now I know the tests are running flawlessly.

---

<div class="post-metadata">

**Author:** ![mattbennett](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.nameko.io/mattbennett/32/13_2.png) [@mattbennett](https://discourse.nameko.io/u/mattbennett)\
**Post date:** [December 6, 2021, 10:01am UTC](https://discourse.nameko.io/t/nameko-test-module-already-imported-warning/714/4 "2021-12-06T10:01:26Z")

</div>

This warning has been suppressed in the latest releases (2.14.1 and 3.0.0-rc11)
