@djangoproject · Post #185 · 05.10.2016 г., 03:03
http://www.aparat.com/v/WC7R4 Introduction to #pytest #unittest
TGINSIGHT SIMILAR POSTS
Изворен канал @pythonotes · Post #201 · 13 јан.
Мы уже знаем, что на текущую сессию интерпретатора изменение PYTHONPATH никак не повлияет. Но если вы запустите дочерний процесс, то он унаследует окружение текущего процесса, а значит и изменения в любых переменных будут на него влиять. Вот небольшой пример: Объявляем переменную user@host:~$ export PYTHONPATH=/path1 Запускаем интерпретатор user@host:~$ python3 Проверим что в sys.path >>> import sys >>> print(sys.path) ['', '/path1', '/usr/lib/...', ...] Добавляем что-то в переменную >>> import os >>> os.emviron['PYTHONPATH'] = '/path1:/path2' >>> print(sys.path) ['', '/path1', '/usr/lib/...', ...] Изменений нет. Но давайте запустим дочерний процесс и посмотрим там >>> os.system('python3') # теперь мы находимся в другом процессе >>> import sys >>> print(sys.path) ['', '/path1', '/path2', '/usr/lib/...', ...] Тоже самое будет и с subprocess, так как по умолчанию текущее окружение тоже наследуется. >>> import subprocess >>> subprocess.call(['python3', '-c', 'import sys;print(sys.path)']) ['', '/path1', '/path2', '/usr/lib/...', ...] ______________________ Лучшей практикой является передача энвайронмента явно через аргумент env! import subprocess subprocess.call(cmd, env={'PYTHONPATH': '...'}) Это поможет точно понимать какое окружение будет у запускаемого процесса и при этом не изменять окружение текущего процесса. #basic
Hashtags
Пребарај: #unittest
@djangoproject · Post #185 · 05.10.2016 г., 03:03
http://www.aparat.com/v/WC7R4 Introduction to #pytest #unittest
@mdcuzbekistan · Post #324 · 23.01.2022 г., 08:14
Dasturni testlash jarayonlari, xUnit bilan amaliyot Bugungi stream ham nasib qilsa ajoyib o'tadi. Sababi, navbatdagi mehmonimiz siz tanigan, bilgan tajribali dasturchilar sirasiga kiradi. Eng qizig'i, suxbat davomida ko'tariladigan mavzu ko'pchilikni qiynashga ulgurgan. Ushbu qiyinchiliklarni ustozimiz bilan birga yengillashtiramiz. Xullas, streamda ko'rishguncha! 🔗 Havola: zoom 👨🏫 Mentor:Wahid Abduhakimov #unittest#mentoring#live#stream .NET Uzbekistan Community ______ Telegram | Instagram | Youtube
Hashtags
@djangoproject · Post #179 · 30.09.2016 г., 07:46
https://pypi.python.org/pypi/MutPy/0.4.0 #MutPy is a mutation #testing tool for Python 3.x source code. MutPy supports standard #unittest module, generates YAML reports and has colorful output. It’s apply mutation on AST level. You could boost your mutation testing process with high order mutations (HOM) and code coverage analysis.
@djangoproject · Post #583 · 17.03.2018 г., 05:46
https://www.pluralsight.com/courses/unit-testing-python This course will help you to write good #unit_test for your Python code, using tools such as #unittest, #doctest and py.test. Unit tests should improve code quality, and also support future development. #test
Hashtags
@djangoproject · Post #178 · 30.09.2016 г., 07:22
#Hypothesis is a Python library for creating #unit_tests which are simpler to write and more powerful when run, finding edge cases in your code you wouldn’t have thought to look for. It is stable, powerful and easy to add to any existing #test suite. #unittest https://hypothesis.readthedocs.io/en/latest/