diff --git a/awx/main/db/profiled_pg/base.py b/awx/main/db/profiled_pg/base.py index da49f290fb..54aae49080 100644 --- a/awx/main/db/profiled_pg/base.py +++ b/awx/main/db/profiled_pg/base.py @@ -68,7 +68,7 @@ class RecordedQueryLog(object): progname = match break else: - progname = os.path.basename(sys.argv[0]) + progname = 'unknown' filepath = os.path.join(self.dest, '{}.sqlite'.format(progname)) version = _get_version('awx') log = sqlite3.connect(filepath, timeout=3) diff --git a/awx/main/tests/unit/test_db.py b/awx/main/tests/unit/test_db.py index dc40ea77f3..4e620d802c 100644 --- a/awx/main/tests/unit/test_db.py +++ b/awx/main/tests/unit/test_db.py @@ -1,7 +1,6 @@ import collections import os import sqlite3 -import sys import unittest import pytest @@ -125,7 +124,7 @@ def test_sql_above_threshold(tmpdir): args, kw = _call assert args == ('EXPLAIN VERBOSE {}'.format(QUERY['sql']),) - path = os.path.join(tmpdir, '{}.sqlite'.format(os.path.basename(sys.argv[0]))) + path = os.path.join(tmpdir, 'unknown.sqlite') assert os.path.exists(path) # verify the results