This repository has been archived by the owner on Aug 11, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create projects with optional virtualenv inside
- Loading branch information
constrict0r
committed
Nov 11, 2018
1 parent
e31e303
commit 4ee2bdc
Showing
3 changed files
with
107 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# Project tests. | ||
import os | ||
import pytest | ||
import subprocess | ||
import shutil | ||
|
||
|
||
from amanita import project | ||
|
||
|
||
# Create project. | ||
def test_create_project(): | ||
|
||
subprocess.check_call('amanita muscaria', | ||
env=os.environ.copy(), | ||
shell=True) | ||
shutil.rmtree(os.path.join('muscaria')) | ||
|
||
|
||
# Create virtual enviroment. | ||
def test_create_venv(): | ||
|
||
project.Project.venv_setup(os.path.join('')) | ||
if not os.path.exists('.venv'): | ||
return False | ||
shutil.rmtree(os.path.join('.venv')) | ||
|
||
|
||
# Create virtual enviroment with non existing path | ||
@pytest.mark.xfail | ||
def test_create_venv_nonexist(): | ||
|
||
project.Project.venv_setup('/dev/null') | ||
|
||
|
||
# Create virtual enviroment with non permission | ||
@pytest.mark.xfail | ||
def test_create_venv_forbidden(): | ||
|
||
project.Project.venv_setup('/root') | ||
|
||
|
||
# Overwrite virtual enviroment. | ||
def test_overwrite_venv(): | ||
|
||
project.Project.venv_setup(os.path.join('')) | ||
project.Project.venv_setup(os.path.join('')) | ||
if not os.path.exists('.venv'): | ||
return False | ||
shutil.rmtree(os.path.join('.venv')) | ||
|
||
|
||
# Create project with virtual enviroment. | ||
def test_create_project_venv(): | ||
|
||
subprocess.check_call('amanita muscaria -e', | ||
env=os.environ.copy(), | ||
shell=True) | ||
if not os.path.exists('muscaria/.venv'): | ||
return False | ||
shutil.rmtree(os.path.join('muscaria')) |