blob: 9511ce47c12602fc75644e78601402cf8437360f [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
11import sys
12
13from chromite.lib import cros_test_lib
14
15class VirtualEnvTest(cros_test_lib.TestCase):
16 """Test that we are running in a virtualenv."""
17
18 def testModuleIsFromVenv(self):
19 """Test that the |six| module was provided by virtualenv."""
20 # Note: The |six| module is chosen somewhat arbitrarily, but it happens to
21 # be provided inside the chromite virtualenv.
22 req_path = os.path.dirname(os.path.realpath(six.__file__))
23 my_path = os.path.dirname(os.path.realpath(__file__))
24 expected_venv_path = os.path.realpath(
25 os.path.join(my_path, '..', 'venv', 'venv'))
26 self.assertIn(expected_venv_path, req_path)