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 use the same name
for the workspace and the top level python package.

Python subdirectory was renamed to avoid conflicts with 'py' package
(https://pypi.org/project/py/).
  • Loading branch information
barancev committed Jul 26, 2019
1 parent 47bc136 commit 0e24f41
Show file tree
Hide file tree
Showing 242 changed files with 48 additions and 10 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 @@ -94,7 +94,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 @@ -286,7 +286,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 @@ -362,12 +362,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 @@ -619,7 +619,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,5 +1,5 @@
workspace(
name = "selenium",
name = "seleniumhq",
managed_directories = {
# Share the node_modules directory between Bazel and other tooling
"@npm": ["node_modules"],
Expand Down
2 changes: 1 addition & 1 deletion javascript/atoms/fragments/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ closure_fragment(
"//dotnet/src/webdriver:__pkg__",
"//java/client/src/org/openqa/selenium/remote:__pkg__",
"//javascript/node/selenium-webdriver/lib/atoms:__pkg__",
"//py:__pkg__",
"//python:__pkg__",
],
deps = [
"//javascript/atoms:dom",
Expand Down
2 changes: 1 addition & 1 deletion javascript/webdriver/atoms/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ closure_fragment(
"//dotnet/src/webdriver:__pkg__",
"//java/client/src/org/openqa/selenium/remote:__pkg__",
"//javascript/node/selenium-webdriver/lib/atoms:__pkg__",
"//py:__pkg__",
"//python:__pkg__",
],
deps = [
":atoms-lib",
Expand Down
36 changes: 36 additions & 0 deletions python/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
genrule(
name = "get-attribute",
srcs = ["//javascript/webdriver/atoms:get-attribute.js"],
outs = ["selenium/webdriver/remote/getAttribute.js"],
cmd = "cp $< $@",
)

genrule(
name = "is-displayed",
srcs = ["//javascript/atoms/fragments:is-displayed.js"],
outs = ["selenium/webdriver/remote/isDisplayed.js"],
cmd = "cp $< $@",
)

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.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 2 additions & 0 deletions python/test/run_pytest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import pytest
raise SystemExit(pytest.main())
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 0e24f41

Please sign in to comment.