blob: 1cc69c9ffd63cb3798347fdd7e92f62e14cb4405 [file] [log] [blame]
Aviv Keshet39853bd2016-09-22 15:12:05 -07001# Copyright 2016 The Chromium OS Authors. All rights reserved.
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5"""Unittests for virtualenv_wrapper"""
6
7from __future__ import print_function
8
9import os
10import six
Aviv Keshet39853bd2016-09-22 15:12:05 -070011
12from chromite.lib import cros_test_lib
13
14class VirtualEnvTest(cros_test_lib.TestCase):
15 """Test that we are running in a virtualenv."""
16
17 def testModuleIsFromVenv(self):
18 """Test that the |six| module was provided by virtualenv."""
19 # Note: The |six| module is chosen somewhat arbitrarily, but it happens to
20 # be provided inside the chromite virtualenv.
21 req_path = os.path.dirname(os.path.realpath(six.__file__))
22 my_path = os.path.dirname(os.path.realpath(__file__))
23 expected_venv_path = os.path.realpath(
24 os.path.join(my_path, '..', 'venv', 'venv'))
25 self.assertIn(expected_venv_path, req_path)