Blues's core library
Project description
下面我要批量调整pytest单元测试,先需要你把测试用例的语言规则写入opencode配置文件 .opencode\AGENTS.md 中(根据我的规则进一步规范后写入):1. 始终使用类风格创建单元测试 2. 测试文件名总是与测试类名一致 3. 一个测试文件只定义一个测试类 4. 测试文件名/类名的命名规则是 Test+功能类名 5. 测试方法的命名规则是 test_功能方法名 6. 当测试入参有多组静态数据时,总是把静态数据提取到独立的.conf文件中(使用json风格定义)
Description
Python library writed by Blues Liu.
pytest
# windows
pytest tests/xx.test.ts
# macos
python3 -m pytest tests/xx.test.ts
Install
install by requirements.txt
pip install -r requirements.txt
// first installation
pip install blues-lib==1.3.14
// upgrade to the newest version
pip install --upgrade blues-lib
sele
BluesDebugChrome
reliant env variables
$env:CHROME_EXE: the chrome's .exe file path - * required
- such as
C:\Users\creep\AppData\Local\Google\Chrome\Application\chrome.exe
$env:CHROME_DRIVER_EXE: the chromedriver's .exe file path - * recommended
- such as
D:\devsoftware\Python38\webdriver\chrome\128.0.6613.86\chromedriver.exe
$env.LOGINER_EXECUTOR: the loginer program path
- dated setting:
D:\devapp\seleniumapp\loginer\Starter.py
input
config = {
'url':'http://deepbluenet.com',
}
arguments = {
'--user-data-dir':'"c:/sele/test3"',
'--remote-debugging-address':'localhost:8003',
}
util
from blues_lib.utils.file.File import File
print(File.exists('dir'))
set/get env variables
// set
[Environment]::SetEnvironmentVariable('LOGINER_EXECUTOR', 'D:\devapp\seleniumapp\loginer\Starter.py','machine')
// get
[Environment]::GetEnvironmentVariable('LOGINER_EXECUTOR','machine')
QA
Selenium Wire CA error
ERROR:cert_verify_proc_builtin.cc(766)] CertVerifyProcBuiltin for at.alicdn.com failed:
----- Certificate i=1 (CN=Selenium Wire CA) -----
Resolve:
- download ca.crt from selenium-wire library
https://github.com/wkeeling/selenium-wire/blob/master/seleniumwire/ca.crt
Execute by powershell scheduled task
task
unRegister-ScheduledTask -TaskName 'srp'
Get-ScheduledTask -TaskName 'srp'
Start-ScheduledTask -TaskName 'srp'
Get-ScheduledTaskInfo -TaskName 'srp'
enable-ScheduledTask -TaskName 'srp'
disable-ScheduledTask -TaskName 'srp'
task in 24hours
$arg='-NoProfile -command "& {set-location -path D:\devapp\pyapp\blues-lib-py\test\srp; python .\NAPSTest.py}"' ; $action = New-ScheduledTaskAction -Execute 'powershell.exe' -Argument $arg ;
$now = Get-Date ;
$interval = New-TimeSpan -Hours 2;
$trigger = New-ScheduledTaskTrigger -Once -RepetitionInterval $interval -At $now ;
Register-ScheduledTask -Action $action -Trigger $trigger -TaskName 'srp'
task in 7:00-23:00
$arg = '-NoProfile -command "& {set-location -path D:\devapp\pyapp\blues-lib-py\test\srp; python .\NAPSTest.py}"'
$action = New-ScheduledTaskAction -Execute 'powershell.exe' -Argument $arg
$startTime = Get-Date -Hour 7 -Minute 0 -Second 0
$trigger = New-ScheduledTaskTrigger -Daily -At $startTime -RepetitionInterval (New-TimeSpan -Hours 2) -RepetitionDuration (New-TimeSpan -Hours 16)
Register-ScheduledTask -Action $action -Trigger $trigger -TaskName 'srp'
# define the execute order
$arg='-NoProfile -command "& {set-location -path D:\devapp\pyapp\blues-lib-py\test\srp; python .\NAPSTest.py}"' ;
# create task
$action = New-ScheduledTaskAction -Execute 'powershell.exe' -Argument $arg ;
$startTime = (Get-Date).Date.AddHours(7);
$interval = New-TimeSpan -Hours 2;
$endTime = (Get-Date).Date.AddHours(23);
# define the trigger
$trigger = New-ScheduledTaskTrigger -Daily -At $startTime -RepetitionInterval $interval -RepetitionDuration ($endTime - $startTime)
Register-ScheduledTask -Action $action -Trigger $trigger -TaskName 'srp'
exe
$chrome="'C:\Program Files (x86)\Google\Chrome\Application\chrome.exe'" ; $arg='-NoProfile -command "& { set-location -path D:\datacross\dist\App; .\App.exe '+$chrome+' }"' ; $action = New-ScheduledTaskAction -Execute 'powershell.exe' -Argument $arg ; $now = Get-Date ; $interval = New-TimeSpan -Hours 1; $trigger = New-ScheduledTaskTrigger -Once -RepetitionInterval $interval -At $now ; Register-ScheduledTask -Action $action -Trigger $trigger -TaskName 'datacross'
install
This develop pc will push pip to officail reigstry ,can't set the mirros
pip install -i https://mirrors.aliyun.com/pypi/simple selenium
pip install -i https://mirrors.aliyun.com/pypi/simple --upgrade selenium
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file blues_lib-1.15.5.tar.gz.
File metadata
- Download URL: blues_lib-1.15.5.tar.gz
- Upload date:
- Size: 167.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.12 {"installer":{"name":"uv","version":"0.11.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fe3e364f9eef0b5386bd009a5113886fe47d6a77fc9005717f7bb9064a9bc09e
|
|
| MD5 |
6bc063467129b35e55d04bf047207b8c
|
|
| BLAKE2b-256 |
f91cc8814b748a7378258df0b4d40ede5f7a3149cf157284f3b55c610869017c
|
File details
Details for the file blues_lib-1.15.5-py3-none-any.whl.
File metadata
- Download URL: blues_lib-1.15.5-py3-none-any.whl
- Upload date:
- Size: 367.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.12 {"installer":{"name":"uv","version":"0.11.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b5df72da5dbc20d9aba3ecf7262c945aa82bc8e0a8aa69944d368d77ade4c0b0
|
|
| MD5 |
1c20e6a4a067a1dd5a0be7386fffc8d2
|
|
| BLAKE2b-256 |
b284e85cd7fc25cd04cb37646fa232ce7f09466d20bad895af49d0652ed4f749
|