[pitivi] tests_: Make sure not to save and use any config data from actual user space
- From: Alexandru Băluț <alexbalut src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi] tests_: Make sure not to save and use any config data from actual user space
- Date: Thu, 26 Jan 2017 00:42:47 +0000 (UTC)
commit 77cc0d87f2f2e080b54d745f8d44ef655a61870c
Author: Thibault Saunier <thibault saunier osg samsung com>
Date: Thu Jan 26 01:23:04 2017 +0100
tests_: Make sure not to save and use any config data from actual user space
Fixes T7677
Reviewed-by: Alex Băluț <alexandru balut gmail com>
Differential Revision: https://phabricator.freedesktop.org/D1595
tests/__init__.py | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
---
diff --git a/tests/__init__.py b/tests/__init__.py
index 31e45f9..7a83955 100644
--- a/tests/__init__.py
+++ b/tests/__init__.py
@@ -6,6 +6,7 @@ import glob
import os
import sys
import unittest
+from tempfile import mkdtemp
def get_pitivi_dir():
@@ -29,7 +30,11 @@ def _prepend_env_paths(**args):
def setup():
"""Sets paths and initializes modules, to be able to run the tests."""
- res = True
+ # Make sure xdg_*_home return temp dirs, to avoid touching
+ # the config files of the developer.
+ os.environ['XDG_DATA_HOME'] = mkdtemp()
+ os.environ['XDG_CONFIG_HOME'] = mkdtemp()
+ os.environ['XDG_CACHE_HOME'] = mkdtemp()
# Make available to configure.py the top level dir.
pitivi_dir = get_pitivi_dir()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]