Fixed problems when running tests and a copy of KiBot is in ~/.local
This commit is contained in:
parent
420757880f
commit
56f5176060
|
|
@ -8,5 +8,10 @@ if prev_dir not in sys.path:
|
||||||
# Utils import
|
# Utils import
|
||||||
from utils import context # noqa: F401
|
from utils import context # noqa: F401
|
||||||
prev_dir = os.path.dirname(prev_dir)
|
prev_dir = os.path.dirname(prev_dir)
|
||||||
if prev_dir not in sys.path:
|
# py-test inserts things at the beginning, so we could end loading an installed copy of KiBot
|
||||||
|
if sys.path[0] != prev_dir:
|
||||||
|
try:
|
||||||
|
sys.path.remove(prev_dir)
|
||||||
|
except ValueError:
|
||||||
|
pass
|
||||||
sys.path.insert(0, prev_dir)
|
sys.path.insert(0, prev_dir)
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,12 @@ from glob import glob
|
||||||
from pty import openpty
|
from pty import openpty
|
||||||
import xml.etree.ElementTree as ET
|
import xml.etree.ElementTree as ET
|
||||||
prev_dir = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
prev_dir = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||||
if prev_dir not in sys.path:
|
# py-test inserts things at the beginning, so we could end loading an installed copy of KiBot
|
||||||
|
if sys.path[0] != prev_dir:
|
||||||
|
try:
|
||||||
|
sys.path.remove(prev_dir)
|
||||||
|
except ValueError:
|
||||||
|
pass
|
||||||
sys.path.insert(0, prev_dir)
|
sys.path.insert(0, prev_dir)
|
||||||
from kibot.misc import (error_level_to_name)
|
from kibot.misc import (error_level_to_name)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue