<s> import sys <EOL> import os <EOL> import envy <EOL> import pkg_resources <EOL> from envy import get_active_venv , get_package_name , get_envy_path , original_backed_up , get_venv_full_package_path , sync , clean <EOL> from envy . decorators import is_active_venv , in_python_package <EOL> from mock import MagicMock , PropertyMock <EOL> from mock import patch <EOL> import argparse <EOL> base = os . getcwd ( ) <EOL> def setup_test ( f ) : <EOL> """<STR_LIT>""" <EOL> def wrap_patches ( * args , ** kwargs ) : <EOL> with patch ( '<STR_LIT>' , return_value = True ) : <EOL> with patch ( '<STR_LIT>' , return_value = "<STR_LIT>" ) : <EOL> with patch ( '<STR_LIT>' , return_value = True ) : <EOL> with patch ( '<STR_LIT>' , return_value = "<STR_LIT>" . format ( base ) ) : <EOL> with patch ( '<STR_LIT>' , return_value = "<STR_LIT>" . format ( base ) ) : <EOL> with patch ( '<STR_LIT>' , return_value = '<STR_LIT>' . format ( base ) ) : <EOL> with patch ( '<STR_LIT>' , return_value = "<STR_LIT>" . format ( base ) ) : <EOL> return f ( * args , ** kwargs ) <EOL> return wrap_patches <EOL> @ patch ( '<STR_LIT>' , return_value = '<STR_LIT>' . format ( base ) ) <EOL> @ setup_test <EOL> def test_sync_package_and_clean ( mock_os ) : <EOL> args = argparse . Namespace ( ) <EOL> args . package = [ '<STR_LIT>' ] <EOL> sync ( args ) <EOL> assert os . path . isdir ( '<STR_LIT>' ) == True <EOL> assert os . path . isfile ( '<STR_LIT>' ) == True <EOL> args . all = False <EOL> clean ( args ) <EOL> assert os . path . isdir ( '<STR_LIT>' ) == False <EOL> assert os . path . isfile ( '<STR_LIT>' ) == False <EOL> @ patch ( '<STR_LIT>' , return_value = '<STR_LIT>' . format ( base ) ) <EOL> @ setup_test <EOL> def test_sync_file_and_clean ( mock_os ) : <EOL> args = argparse . Namespace ( ) <EOL> args . package = [ '<STR_LIT>' ] <EOL> sync ( args ) <EOL> assert os . path . isdir ( '<STR_LIT>' ) == True <EOL> assert os . path . isfile ( '<STR_LIT>' ) == True <EOL> args . all = True <EOL> clean ( args ) <EOL> assert os . path . isdir ( '<STR_LIT>' ) == False <EOL> assert os . path . isfile ( '<STR_LIT>' ) == False <EOL> @ patch ( '<STR_LIT>' , return_value = '<STR_LIT>' . format ( base ) ) <EOL> @ setup_test <EOL> def test_sync_file_from_inner_dir_and_clean ( mock_os ) : <EOL> args = argparse . Namespace ( ) <EOL> args . package = [ '<STR_LIT>' ] <EOL> sync ( args ) <EOL> assert os . path . isdir ( '<STR_LIT>' ) == True <EOL> assert os . path . isfile ( '<STR_LIT>' ) == True <EOL> args . all = False <EOL> clean ( args ) <EOL> assert os . path . isdir ( '<STR_LIT>' ) == False <EOL> assert os . path . isfile ( '<STR_LIT>' ) == False </s>
