How to use example123 method in tox

Best Python code snippet using tox_python

test_z_cmdline.py

Source:test_z_cmdline.py Github

copy

Full Screen

...433 result = cmd()434 result.assert_fail()435 assert result.outlines[-1].startswith("ERROR: python: InvocationError for command ")436@pytest.fixture437def example123(initproj):438 yield initproj(439 "example123-0.5",440 filedefs={441 "tests": {442 "test_hello.py": """443 def test_hello(pytestconfig):444 pass445 """,446 },447 "tox.ini": """448 [testenv]449 changedir=tests450 commands= pytest --basetemp={envtmpdir} \451 --junitxml=junit-{envname}.xml...

Full Screen

Full Screen

getStockInfo.py

Source:getStockInfo.py Github

copy

Full Screen

1import requests2from bs4 import BeautifulSoup as bs3import json4import sys,os5import time6############################################################################7# 이 getStockInfo.py를 기준으로 1단계 상위 디렉토리 레벨선상에 있는 resource파일을 가져오기 위해8# import sys, os를 사용하고, sys.path.append(...)로 이를 가능하게 한다.9sys.path.append(os.path.dirname(os.path.abspath(os.path.dirname(__file__))))10# resource 파일 내의 getWonwhaString이란 모듈(*.py)을 가져온다.11from resource.sub_function_used_globally import getWonwhaString12# 로깅 처리 함수 불러오기13from resource.sub_function_used_globally.printCommandLog import printCommandLog as printCommandLog14############################################################################15def getStockInfo(fromWho, companyName):16 _START_TIME = time.time()17 if getStockCode(companyName) == 404: # 종목 없음 에러 코드18 return 404 # 함수 종료19 try:20 companyCode = getStockCode(companyName)21 printCommandLog(fromWho, "show stock --search {} (Function)".format(companyName), "RUNNING", "Getting Stock Information : " + companyName)22 #print("getting information about : " + companyName)23 url = "https://finance.daum.net/api/quote/A" + companyCode + "/sectors"24 response = requests.get(url)25 headers = {26 'Referer' : 'https://finance.daum.net/quotes/A' + companyCode,27 'User-Agent' : 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Whale/2.9.116.15 Safari/537.36'28 }29 response = requests.get(url, headers=headers, timeout=0.9)30 except:31 printCommandLog("show stock --search {} (Function)".format(companyName), "RUNNING", "NO_RESPONSE_RETURNED")32 return 404, 404, 404, 404, 404, 404, 40433 stockData = response.json()34 #print(type(stockData)) # Dictionary 타입35 stockData = list(stockData.values())36 #print(type(stockData))37 # print("종목코드 : " + stockData[0][0].get("symbolCode"))38 # print("종목이름 : " + stockData[0][0].get("name"))39 # print("종목가격 : " + str(stockData[0][0].get("tradePrice")).replace('.0','') + " 원")40 # print("종목가격 변동량 : " + str(stockData[0][0].get("changePrice")) + " 원")41 # print("종목가격 변동률 : " + str(stockData[0][0].get("changeRate") * 100) + " %")42 # print("시가총액 : ≈ " + str(stockData[0][0].get("marketCap")).replace('.0','')[:6] + " 억 원")43 symbolCode = stockData[0][0].get("symbolCode")[1:] # 종목 코드44 companyName = stockData[0][0].get("name") # 종목 이름45 46 tradePrice = str(stockData[0][0].get("tradePrice")).replace('.0','') # 종목 가격47 tradePrice = "{:,}".format(int(tradePrice)) + " 원" # 1,000 단위마다 콤마 붙이기, 원 기호 48 changePrice = str(stockData[0][0].get("changePrice")).replace('.0','') # 종목 가격 변동량49 changePrice = "{:,}".format(int(changePrice)) + " 원" # 1,000 단위마다 콤마 붙이기, 원 기호50 changeRate = str(round((stockData[0][0].get("changeRate") * 100),2)) + " %" # 종목 가격 변동률51 52 marketCap = str(stockData[0][0].get("marketCap")).replace('.0','') # 시가총액53 marketCap = "≈ " + getWonwhaString.getWonhwaString(int(marketCap)) + " 원" 54 resultForPrintCommandLog = "RESULT > {} | {} | {} | {} | {} | {}".format(symbolCode, companyName, tradePrice, changePrice, changeRate, marketCap)55 printCommandLog(fromWho, "show stock --search {}(Function)".format(companyName), "RUNNING", resultForPrintCommandLog)56 57 _END_TIME = time.time()58 running_time = round((_END_TIME - _START_TIME), 4)59 printCommandLog(fromWho, "show stock --search {}(Function)".format(companyName), "RUNNING", "running time : " + str(running_time) + " sec/pass")60 #print("running time : ", str(running_time) + " SEC.")61 return symbolCode, companyName, tradePrice, changePrice, changeRate, marketCap, str(running_time)62def getStockCode(companyName):63 file = open('./resource/stock_function_data/stockCodeList.txt','rt', encoding='UTF8')64 65 try:66 while True:67 line = file.readline()68 if companyName == line.split()[0]: #정확한 회사명만 검색69 code = line.split('\t')[1].strip()70 break71 if not line:72 return 40473 except: # 제대로 입력하지 않아 예외가 생기면 모두 404 에러처리74 return 40475 file.close()76 return code77# print(getStockInfo("fromWhoExample123", "삼성전자"))78# print(getStockInfo("fromWhoExample123", "LG"))79# print(getStockInfo("fromWhoExample123", "CJ대한통운"))80# print(getStockInfo("fromWhoExample123", "카카오"))81# print(getStockInfo("fromWhoExample123", "BGF리테일"))82# print(getStockInfo("fromWhoExample123", "CJ제일제당"))83# print(getStockInfo("fromWhoExample123", "대한항공"))84# print(getStockInfo("fromWhoExample123", "롯데제과"))85# print(getStockInfo("fromWhoExample123", "이트론"))86# print(getStockInfo("fromWhoExample123", "씨젠"))87# print(getStockInfo("fromWhoExample123", "아모레퍼시픽"))88# print(getStockInfo("fromWhoExample123", "엔씨소프트"))89# print(getStockInfo("fromWhoExample123", "한국전력"))90# print(getStockInfo("fromWhoExample123", "삼성생명"))91# print(getStockInfo("fromWhoExample123", "KT"))92# print(getStockInfo("fromWhoExample123", "넷마블"))...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run tox automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful