Skip to content

Commit 0e24f41

Browse files
committed
Running python unit tests with bazel
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/).
1 parent 47bc136 commit 0e24f41

File tree

242 files changed

+48
-10
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

242 files changed

+48
-10
lines changed

.idea/modules.xml

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Rakefile

+6-6
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ end
9494
crazy_fun.create_tasks(Dir["common/**/build.desc"])
9595
crazy_fun.create_tasks(Dir["cpp/**/build.desc"])
9696
crazy_fun.create_tasks(Dir["javascript/**/build.desc"])
97-
crazy_fun.create_tasks(Dir["py/**/build.desc"])
97+
crazy_fun.create_tasks(Dir["python/**/build.desc"])
9898
crazy_fun.create_tasks(Dir["rake-tasks/**/build.desc"])
9999
crazy_fun.create_tasks(Dir["rb/**/build.desc"])
100100
crazy_fun.create_tasks(Dir["third_party/**/build.desc"])
@@ -286,7 +286,7 @@ task :test_rb_remote => [
286286
("//rb:remote-edge-test" if windows?)
287287
].compact
288288

289-
task :test_py => [ :py_prep_for_install_release, "//py:marionette_test:run" ]
289+
task :test_py => [ :py_prep_for_install_release, "//python:marionette_test:run" ]
290290

291291
task :test => [ :test_javascript, :test_java, :test_rb ]
292292
if (python?)
@@ -362,12 +362,12 @@ end
362362

363363
task :py_prep_for_install_release => [
364364
:chrome,
365-
"//py:prep"
365+
"//python:prep"
366366
]
367367

368-
task :py_docs => ["//py:init", "//py:docs"]
368+
task :py_docs => ["//python:init", "//python:docs"]
369369

370-
task :py_install => "//py:install"
370+
task :py_install => "//python:install"
371371

372372
task :py_release => :py_prep_for_install_release do
373373
sh "python setup.py sdist bdist_wheel upload"
@@ -619,7 +619,7 @@ namespace :copyright do
619619
"javascript/selenium-core/scripts/xmlextras.js",
620620
"javascript/selenium-core/xpath/**/*.js"))
621621
Copyright.Update(
622-
FileList["py/**/*.py"],
622+
FileList["python/**/*.py"],
623623
:style => "#")
624624
Copyright.Update(
625625
FileList["rb/**/*.rb"],

WORKSPACE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
workspace(
2-
name = "selenium",
2+
name = "seleniumhq",
33
managed_directories = {
44
# Share the node_modules directory between Bazel and other tooling
55
"@npm": ["node_modules"],

javascript/atoms/fragments/BUILD.bazel

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ closure_fragment(
2727
"//dotnet/src/webdriver:__pkg__",
2828
"//java/client/src/org/openqa/selenium/remote:__pkg__",
2929
"//javascript/node/selenium-webdriver/lib/atoms:__pkg__",
30-
"//py:__pkg__",
30+
"//python:__pkg__",
3131
],
3232
deps = [
3333
"//javascript/atoms:dom",

javascript/webdriver/atoms/BUILD.bazel

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ closure_fragment(
4343
"//dotnet/src/webdriver:__pkg__",
4444
"//java/client/src/org/openqa/selenium/remote:__pkg__",
4545
"//javascript/node/selenium-webdriver/lib/atoms:__pkg__",
46-
"//py:__pkg__",
46+
"//python:__pkg__",
4747
],
4848
deps = [
4949
":atoms-lib",

python/BUILD.bazel

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
genrule(
2+
name = "get-attribute",
3+
srcs = ["//javascript/webdriver/atoms:get-attribute.js"],
4+
outs = ["selenium/webdriver/remote/getAttribute.js"],
5+
cmd = "cp $< $@",
6+
)
7+
8+
genrule(
9+
name = "is-displayed",
10+
srcs = ["//javascript/atoms/fragments:is-displayed.js"],
11+
outs = ["selenium/webdriver/remote/isDisplayed.js"],
12+
cmd = "cp $< $@",
13+
)
14+
15+
py_library(
16+
name = "main",
17+
srcs = glob(["selenium/**/*.py"]),
18+
data = [
19+
":get-attribute",
20+
":is-displayed",
21+
],
22+
imports = ["."],
23+
visibility = ["//visibility:public"],
24+
)
25+
26+
py_test(
27+
name = "unit",
28+
size = "small",
29+
srcs = glob([
30+
"test/unit/**/*.py",
31+
]) + [ "test/run_pytest.py" ],
32+
main = "test/run_pytest.py",
33+
deps = [
34+
":main",
35+
],
36+
)
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.

python/test/run_pytest.py

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
import pytest
2+
raise SystemExit(pytest.main())
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)