Kill python background process gitlab-ci

I’m trying to kill a python job started in background in an Alpine docker in a gitlab-ci:

Python

import asyncio

def main():
    loop = asyncio.get_event_loop()
    try:
        loop.run_forever()
    except KeyboardInterrupt:
        print('Stopping')


if __name__ == '__main__':
    main()

Here are the commands that are ran.

$ COVERAGE_FILE=.coverage.test coverage run test.py &
$ TEST_PID=$!
$ echo "${TEST_PID}"
26
$ kill -SIGINT ${TEST_PID}
$ jobs -l
[1]+  26 Running                 
$ kill -9 ${TEST_PID}
$ jobs -l
[1]+  26 Running                 

I can never see the .coverage.test as the job never finishes.
However it seems to work fine when I run the commands locally.

Source: StackOverflow