Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
forked frompoise/python

Commita96af3b

Browse files
author
Joshua Timberman
committed
Merge pull requestpoise#47 from mopub-cookbooks/COOK-2444
Python cookbook
2 parentsa32c146 +ada1f90 commita96af3b

File tree

10 files changed

+164
-2
lines changed

10 files changed

+164
-2
lines changed

‎.kitchen.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ platforms:
2626
driver_config:
2727
box:opscode-centos-5.9
2828
box_url:https://opscode-vm-bento.s3.amazonaws.com/vagrant/opscode_centos-5.9_provisionerless.box
29-
29+
3030
-name:centos-6.4
3131
driver_config:
3232
box:opscode-centos-6.4
@@ -42,3 +42,13 @@ suites:
4242
run_list:
4343
-recipe[python]
4444
attributes:{python: {install_method: "source"}}
45+
-name:exert
46+
excludes:["centos-5.9"]
47+
run_list:
48+
-recipe[python]
49+
-recipe[python_test::test_exert]
50+
-name:virtualenv
51+
excludes:["centos-5.9"]
52+
run_list:
53+
-recipe[python]
54+
-recipe[python_test::test_virtualenv]

‎Berksfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,6 @@ metadata
55
group:integrationdo
66
cookbook"apt"
77
cookbook"yum"
8-
end
8+
cookbook"build-essential"
9+
cookbook"python_test",:path=>"./test/cookbooks/python_test"
10+
end

‎Gemfile

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
source'https://rubygems.org'
2+
3+
gem'rake'
4+
gem'rspec'
5+
gem'foodcritic'
6+
gem'berkshelf'
7+
gem'thor-foodcritic'
8+
gem'vagrant-wrapper'
9+
10+
group:integrationdo
11+
gem'test-kitchen',:git=>"git://github.com/opscode/test-kitchen.git"
12+
gem'kitchen-vagrant',:git=>"git://github.com/opscode/kitchen-vagrant.git"
13+
gem'kitchen-ec2',:git=>"git://github.com/opscode/kitchen-ec2.git"
14+
gem'kitchen-lxc',:git=>"https://github.com/portertech/kitchen-lxc.git",:tag=>'v0.0.1.beta2'
15+
end

‎test/cookbooks/python_test/README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
python_test Cookbook
2+
====================
3+
4+
This cookbook tests the pip and virtualenv providers
5+
6+
Requirements
7+
------------
8+
9+
####packages
10+
-`python` - Version*2.5* or higher
11+
12+
License and Authors
13+
-------------------
14+
Authors: Scott Likens<scott@mopub.com>
15+
Sean Porter<portertech@gmail.com>
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
name'python_test'
2+
maintainer'Scott Likens'
3+
maintainer_email'scott@mopub.com'
4+
license'Apache 2.0'
5+
description'Installs/Configures python_test'
6+
long_descriptionIO.read(File.join(File.dirname(__FILE__),'README.md'))
7+
version'0.1.0'
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#
2+
# Author:: Scott M. Likens <scott@mopub.com>
3+
# Cookbook Name:: python
4+
# Recipe:: test_exert
5+
#
6+
# Copyright 2013, MoPub, Inc.
7+
#
8+
# Licensed under the Apache License, Version 2.0 (the "License");
9+
# you may not use this file except in compliance with the License.
10+
# You may obtain a copy of the License at
11+
#
12+
# http://www.apache.org/licenses/LICENSE-2.0
13+
#
14+
# Unless required by applicable law or agreed to in writing, software
15+
# distributed under the License is distributed on an "AS IS" BASIS,
16+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17+
# See the License for the specific language governing permissions and
18+
# limitations under the License.
19+
#
20+
21+
python_virtualenv"#{Chef::Config[:file_cache_path]}/virtualenv"do
22+
interpreter"python"
23+
owner"root"
24+
group"root"
25+
action:create
26+
end
27+
28+
python_pip"boto"do
29+
action:install
30+
virtualenv"#{Chef::Config[:file_cache_path]}/virtualenv"
31+
end
32+
33+
python_pip"psutil"do
34+
action:install
35+
end
36+
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#
2+
# Author:: Sean Porter <portertech@hw-ops.com>
3+
# Cookbook Name:: python
4+
# Recipe:: test_virtualenv
5+
#
6+
# Copyright 2013, Heavy Water Operations, LLC.
7+
#
8+
# Licensed under the Apache License, Version 2.0 (the "License");
9+
# you may not use this file except in compliance with the License.
10+
# You may obtain a copy of the License at
11+
#
12+
# http://www.apache.org/licenses/LICENSE-2.0
13+
#
14+
# Unless required by applicable law or agreed to in writing, software
15+
# distributed under the License is distributed on an "AS IS" BASIS,
16+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17+
# See the License for the specific language governing permissions and
18+
# limitations under the License.
19+
#
20+
21+
python_virtualenv"/tmp/virtualenv"do
22+
interpreter"python"
23+
owner"root"
24+
group"root"
25+
action:create
26+
end
27+
28+
python_virtualenv"isolated python environment"do
29+
path"/tmp/tobedestroyed"
30+
interpreter"python"
31+
action:create
32+
end
33+
34+
python_virtualenv"deleting the isolated python environment"do
35+
path"/tmp/tobedestroyed"
36+
action:delete
37+
end
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/usr/bin/env bats
2+
3+
@test"virtualenv test environment should exist" {
4+
[-f"/tmp/kitchen-chef-solo/cache/virtualenv/bin/activate" ]
5+
}
6+
7+
@test"virtualenv test environment should be owned by root" {
8+
ls -l /tmp/kitchen-chef-solo/cache/virtualenv| grep"root root"
9+
}
10+
11+
@test"virtualenv test environment should have boto working" {
12+
/tmp/kitchen-chef-solo/cache/virtualenv/bin/python -c'import boto; boto.Version'
13+
}
14+
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/usr/bin/env bats
2+
3+
@test"python bin should exist" {
4+
[-x"/usr/local/bin/python" ]
5+
}
6+
7+
@test"python should be version 2.7.5" {
8+
/usr/local/bin/python -c'import sys; print sys.version'| grep'2.7.5'
9+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/usr/bin/env bats
2+
3+
@test"virtualenv test environment should exist" {
4+
[-f"/tmp/virtualenv/bin/activate" ]
5+
}
6+
7+
@test"virtualenv test environment should be owned by root" {
8+
ls -l /tmp/virtualenv| grep"root root"
9+
}
10+
11+
@test"virtualenv test environment should have a working python" {
12+
/tmp/virtualenv/bin/python -c'import sys; print sys.version'
13+
}
14+
15+
@test"virtualenv resource should be able to delete an environment" {
16+
[!-d"/tmp/tobedestroyed" ]
17+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp