Separating testsetup in .rst files

Hi Team,
I have certain testcode which only requires subset of certain imports hence I’ve created different testsetup groups as such in my document_test.rst file:

.. testsetup:: *

    import os
    import pathlib
    from tests.test_etc import EtcTest
    from etc import EncConfigParser
    from enc import ConfigVersion
    from configparser import RawConfigParser

    def full_path(path):
        this_dir = pathlib.Path(os.getcwd(), '|V0_DOCS_DIR|')
        return pathlib.Path(this_dir, path)
.. testsetup:: Exception_catch

    from etc import EncConfigError

Now I use these as such:

.. testcode:: Exception_catch,ORed_section_starting_with_delimiter

    with open(full_path('|ORed_section_starting_with_delimiter|')) as mf:
        EtcTest(mf, EncConfigParser.for_version(ConfigVersion.v0)).raises(EncConfigError)

But I get an import error stating:
NameError: name 'EncConfigError' is not defined.

I am following the Directives section of sphinx.ext.doctest. I also feel a bit lost as there are no examples given on the page and also not much info on net.

Any help regarding this will be appreciated.