Skip to content

Commit

Permalink
General cleanup of test_firefox_py rake task.
Browse files Browse the repository at this point in the history
r8462
  • Loading branch information
hugs committed Feb 26, 2010
1 parent 7baaede commit e61e4cd
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 61 deletions.
5 changes: 4 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
prune *
global-include build/webdriver-extension.zip
recursive-include common/src/web *.dll *.js *.gif *.html *.cs *.xhtml
recursive-include common/src/web *.txt *.Config
recursive-include common/src/py *.py
recursive-include common/test/py *.py
recursive-include chrome/src/py *.py
recursive-include chrome/test/py *.py
recursive-include firefox/src/py *.py
recursive-include firefox/src/py *.zip
recursive-include firefox/src/py *.xpi
recursive-include jobbie/src/py *.py
recursive-include jobbie/test/py *.py
recursive-include remote/client/src/py *.py
Expand Down
21 changes: 11 additions & 10 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -631,24 +631,25 @@ task :javadocs => [:common, :firefox, :htmlunit, :jobbie, :remote, :support, :ch
end

task :test_firefox_py => [:firefox, :firefox_xpi] do
# This requires virtualenv
# To install virtualenv:
# easy_install virtualenv
if python? then
sh "virtualenv build/python", :verbose => true do |ok, res|
if ! ok
puts ""
puts "PYTHON DEPENDENCY ERROR: Virtualenv not found."
puts "Please run '[sudo] easy_install install virtualenv' or"
puts " '[sudo] pip install virtualenv'"
puts "Please run '[sudo] pip install virtualenv'"
puts ""
end
end
sh "build/python/bin/easy_install pip", :verbose => true
sh "build/python/bin/pip install simplejson", :verbose => true
sh "build/python/bin/pip install py", :verbose => true
sh "build/python/bin/python setup.py build install", :verbose => true
sh "build/python/bin/py.test build/lib/selenium/firefox_tests", :verbose => true
sh "build/python/bin/pip install simplejson py", :verbose => true
cp 'build/webdriver-extension.zip', "firefox/src/py/", :verbose => true
sh "build/python/bin/python setup.py build", :verbose => true
if File.exists?('build/python/bin/py.test')
py_test = 'build/python/bin/py.test'
else
py_test = 'py.test'
end
test_dir = Dir.glob('build/lib**/selenium/firefox_tests').first
sh py_test, test_dir, :verbose => true
end
end

Expand Down
3 changes: 1 addition & 2 deletions firefox/src/py/firefox_profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,7 @@ def __init__(self, name=ANONYMOUS_PROFILE_NAME, port=DEFAULT_PORT,
self.name = name
self.port = port
if (extension_path is None):
self.extension_path = os.path.join(os.path.dirname(__file__), '..',
'build_artifacts', 'webdriver-extension.zip')
self.extension_path = os.path.join(os.path.dirname(__file__), 'webdriver-extension.zip')
else:
self.extension_path = extension_path

Expand Down
50 changes: 2 additions & 48 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,53 +14,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from glob import glob
import os, shutil
import subprocess
from setuptools import setup
from setuptools.command.install import install as _install

class install(_install):
def run(self):
_install.run(self)

# Ugly hack to use rake to build webdriver-extension.zip
# and put it where we're looking for it
root_dir = os.path.abspath(os.path.dirname(__file__))
artifacts_dir = os.path.join(root_dir, 'build/lib/selenium/build_artifacts')
webdriver_extension = os.path.join(root_dir, 'build/webdriver-extension.zip')
os.chdir(root_dir)
#subprocess.call(['rake', 'firefox_xpi'])
try:
os.makedirs(artifacts_dir)
except OSError:
# Dir was already created
pass
shutil.copy(webdriver_extension, artifacts_dir)

TEST_WEB_DIR = 'common/src/web'

def get_extensions_list(in_dir):
files_list = []
for dirname, subdirs, filenames in os.walk(in_dir):
if (dirname.find('.svn') == -1):
files_list.extend(filenames)
return set([t.split('.')[-1] for t in files_list if len(t.split('.')) > 0])

def get_dirs_list(in_dir):
ret_list = []
for dirname, subdirs, filenames in os.walk(in_dir):
if (dirname.find('.svn') == -1):
ret_list.append(dirname.replace(TEST_WEB_DIR + '/', ''))
return ret_list

test_web_dirs = get_dirs_list(TEST_WEB_DIR)
test_web_extensions = get_extensions_list(TEST_WEB_DIR)

all_dirs_and_extensions = []
for dir in test_web_dirs:
for ext in test_web_extensions:
all_dirs_and_extensions.append(dir + '/*.' + ext)
from setuptools.command.install import install

setup(
cmdclass={'install': install},
Expand Down Expand Up @@ -95,8 +50,7 @@ def get_dirs_list(in_dir):
'selenium.chrome_tests',
'selenium.remote_tests'],
include_package_data=True,
package_data={'': ['*.' + t for t in test_web_extensions],
'selenium.common_web':all_dirs_and_extensions}
install_requires=['distribute'],
)

# FIXME: Do manually
Expand Down

0 comments on commit e61e4cd

Please sign in to comment.