Skip to content

Commit

Permalink
Running python unit tests with bazel
Browse files Browse the repository at this point in the history
Workspace was renamed because bazel does not allow to give the same name
to the workspace and the top level python package.

Python subdirectory was renames from py to python to avoid conflicts
with 'py' package (https://pypi.org/project/py/)
  • Loading branch information
barancev committed Dec 12, 2018
1 parent 13a1104 commit 99fc0e0
Show file tree
Hide file tree
Showing 330 changed files with 11,035 additions and 39 deletions.
2 changes: 1 addition & 1 deletion .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ end
crazy_fun.create_tasks(Dir["common/**/build.desc"])
crazy_fun.create_tasks(Dir["cpp/**/build.desc"])
crazy_fun.create_tasks(Dir["javascript/**/build.desc"])
crazy_fun.create_tasks(Dir["py/**/build.desc"])
crazy_fun.create_tasks(Dir["python/**/build.desc"])
crazy_fun.create_tasks(Dir["rake-tasks/**/build.desc"])
crazy_fun.create_tasks(Dir["rb/**/build.desc"])
crazy_fun.create_tasks(Dir["third_party/**/build.desc"])
Expand Down Expand Up @@ -284,7 +284,7 @@ task :test_rb_remote => [
("//rb:remote-edge-test" if windows?)
].compact

task :test_py => [ :py_prep_for_install_release, "//py:marionette_test:run" ]
task :test_py => [ :py_prep_for_install_release, "//python:marionette_test:run" ]

task :test => [ :test_javascript, :test_java, :test_rb ]
if (python?)
Expand Down Expand Up @@ -360,12 +360,12 @@ end

task :py_prep_for_install_release => [
:chrome,
"//py:prep"
"//python:prep"
]

task :py_docs => ["//py:init", "//py:docs"]
task :py_docs => ["//python:init", "//python:docs"]

task :py_install => "//py:install"
task :py_install => "//python:install"

task :py_release => :py_prep_for_install_release do
sh "python setup.py sdist bdist_wheel upload"
Expand Down Expand Up @@ -587,7 +587,7 @@ namespace :copyright do
"javascript/selenium-core/scripts/xmlextras.js",
"javascript/selenium-core/xpath/**/*.js"))
Copyright.Update(
FileList["py/**/*.py"],
FileList["python/**/*.py"],
:style => "#")
Copyright.Update(
FileList["rb/**/*.rb"],
Expand Down
2 changes: 1 addition & 1 deletion WORKSPACE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
workspace(name = "selenium")
workspace(name = "seleniumhq")

http_archive(
name = "io_bazel_rules_closure",
Expand Down
1 change: 1 addition & 0 deletions javascript/atoms/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ selenium_js_fragment(
function = "bot.dom.isShown",
visibility = [
"//java/client/src/org/openqa/selenium/remote:__pkg__",
"//python:__pkg__",
],
deps = [
":atoms",
Expand Down
1 change: 1 addition & 0 deletions javascript/webdriver/atoms/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ selenium_js_fragment(
function = "webdriver.atoms.element.attribute.get",
visibility = [
"//java/client/src/org/openqa/selenium/remote:__pkg__",
"//python:__pkg__",
],
deps = [
":atoms",
Expand Down
40 changes: 40 additions & 0 deletions python/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
genrule(
name = "is-displayed",
srcs = [
"//javascript/atoms:is-displayed.js",
],
outs = ["selenium/webdriver/remote/isDisplayed.js"],
cmd = "cp \"$(location //javascript/atoms:is-displayed.js)\" \"$@\"",
)

genrule(
name = "get-attribute",
srcs = [
"//javascript/webdriver/atoms:get-attribute.js",
],
outs = ["selenium/webdriver/remote/getAttribute.js"],
cmd = "cp \"$(location //javascript/webdriver/atoms:get-attribute.js)\" \"$@\"",
)

py_library(
name = "main",
srcs = glob(["selenium/**/*.py"]),
data = [
":get-attribute",
":is-displayed",
],
imports = ["."],
visibility = ["//visibility:public"],
)

py_test(
name = "unit",
size = "small",
srcs = glob([
"test/unit/**/*.py",
]) + [ "test/run_pytest.py" ],
main = "test/run_pytest.py",
deps = [
":main",
],
)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
19 changes: 19 additions & 0 deletions python/build/lib/selenium/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Licensed to the Software Freedom Conservancy (SFC) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The SFC licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.


__version__ = "3.8.0"
File renamed without changes.

0 comments on commit 99fc0e0

Please sign in to comment.